locked
Error - The best overloaded method match for Report.Calculate(int) has some invalid arguments RRS feed

  • Question

  • User-797751191 posted

    Hi

      I have below code

    HiddenField hdf_No = (gv.FindControl("hdfNo") as HiddenField);
    if (hdf_No != null)
                        {
                            var hdf0 = hdf_No.Value;
                                Calculate(hdf0);
                        }

    Saturday, June 29, 2019 7:07 AM

Answers

  • User665608656 posted

    Hi jsshivalik,

    According to your description, this error indicates that the parameter your Calculate method needs to pass in is an int-type data.

    However when you call it, you pass in the value of the HiddenField control, which defaults to string type, so you need to convert this parameter to int type when you call the Calculate method successfully.

    You could refer to this link: https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.hiddenfield.value?view=netframework-4.8

    You can refer to the following code:

    HiddenField hdf_No = (gv.FindControl("hdfNo") as HiddenField);
    if (hdf_No != null)
                        {
                             int hdf0 = Convert.ToInt32(hdf_No.Value.ToString());
                                Calculate(hdf0);
                        }

    Best Regards,

    YongQing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 1, 2019 2:13 AM