locked
GridView update crashes gives System.InvalidOperationException: A public method with the name '' was either not found or there were multiple methods with the same name on the type error RRS feed

  • Question

  • User161939409 posted

    Every time I click the Update button in my gridview my application crashes with the below error. Currently the Update command is empty and it still throws this error

    Here's the exception details:

    Server Error in '/' Application.

    A public method with the name 'UpdateReport' was either not found or there were multiple methods with the same name on the type 'ASP.contractingreport_aspx'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.InvalidOperationException: A public method with the name 'UpdateReport' was either not found or there were multiple methods with the same name on the type 'ASP.contractingreport_aspx'.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

    Here's the stack trace:

    [InvalidOperationException: A public method with the name 'UpdateReport' was either not found or there were multiple methods with the same name on the type 'ASP.contractingreport_aspx'.] System.Web.UI.WebControls.ModelDataSourceView.FindMethod(String methodName) +2546469 System.Web.UI.WebControls.ModelDataSourceView.RequireAsyncModelBinding(String methodName, ModelDataSourceMethod& method) +69 System.Web.UI.WebControls.ModelDataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback) +103 System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation) +1244 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +917 System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e) +92 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e) +97 System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37 System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +127 System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +168 System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9845228

    Heres the function that is breaking

    Protected Sub GVContracting_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GVContracting.RowUpdating

    End Sub

    Here is the Gridview code

    <asp:GridView
    Runat="Server"
    ID="GVContracting"
    CssClass="grid"
    HeaderStyle-CssClass="header"
    HeaderStyle-ForeColor="White"
    DataKeyNames="pkeyOpenItemID"
    PageSize="100"
    AllowPaging="True"
    AllowSorting="true"
    AutoGenerateEditButton="True"
    AutoGenerateColumns="False"
    ItemType="VISN_UDO_2.Data.v_UDO_ContractingReportwStatus"
    SelectMethod="contractingGrid_GetData"
    OnRowDataBound="GridView1_RowDataBound"
    EmptyDataText="No contracting data available for this Station."
    EmptyDataRowStyle-HorizontalAlign="Left"
    EmptyDataRowStyle-BackColor="#FFFFCA">
    <Columns>
    <asp:DynamicField DataField="Station" HeaderText="Station" ReadOnly="True" SortExpression="Station" />
    <asp:DynamicField DataField="PO" HeaderText="PO" ReadOnly="True" SortExpression="PO" />
    <asp:DynamicField DataField="fldFund" HeaderText="Fund" ReadOnly="True" SortExpression="fldFund" />
    <asp:DynamicField DataField="fldBFYs" HeaderText="BFY" ReadOnly="True" SortExpression="fldBFYs" >
    <ItemStyle HorizontalAlign="Left" Width="33px" /></asp:DynamicField>
    <asp:DynamicField DataField="fldFCP" HeaderText="FCP" ReadOnly="True" SortExpression="fldFCP" />
    <asp:DynamicField DataField="fldSBU" HeaderText="SBU" ReadOnly="True" SortExpression="fldSBU" />
    <asp:DynamicField DataField="fldDIV" HeaderText="DIV" ReadOnly="True" SortExpression="fldDIV" />
    <asp:DynamicField DataField="fldDays" HeaderText="Days" ReadOnly="True" SortExpression="fldDays" />
    <asp:DynamicField DataField="fldAmount" HeaderText="Amount" ReadOnly="True" SortExpression="fldAmount" DataFormatString="{0:C2}"/>
    <asp:DynamicField DataField="fldIFCAPEndDate" ItemStyle-Wrap="False" HeaderText="IFCAP End Date" ReadOnly="True" SortExpression="fldIFCAPEndDate" />
    <asp:DynamicField DataField="fldTransactionNumber" HeaderText="Transaction Number" ReadOnly="True" SortExpression="fldTransactionNumber" />
    <asp:DynamicField DataField="fldVendor" HeaderText="Vendor" ReadOnly="True" SortExpression="fldVendor" />
    <asp:DynamicField DataField="fldAgentAssigned" HeaderText="Agent Assigned" ReadOnly="True" SortExpression="fldAgentAssigned" />
    <asp:DynamicField DataField="fldFiscalComments" HeaderText="Fiscal Comments" ReadOnly="True" SortExpression="fldFiscalComments" />
    <asp:DynamicField DataField="fldReasonJustification" HeaderText="Reason Justification" ReadOnly="True" SortExpression="fldReasonJustification" />
    <asp:DynamicField DataField="ReasonDate" HeaderText="Reason Date" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="ReasonDate" />
    <asp:DynamicField DataField="ReasonBy" HeaderText="Reason By" ReadOnly="True" SortExpression="ReasonBy" />
    <asp:DynamicField DataField="fldActionTaken" HeaderText="Action Taken" ReadOnly="True" SortExpression="fldActionTaken" />
    <asp:DynamicField DataField="fldFiscalAction" HeaderText="Fiscal Action" ReadOnly="True" SortExpression="fldFiscalAction" />
    <asp:DynamicField DataField="ActionDate" HeaderText="Action Date" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="ActionDate" />
    <asp:DynamicField DataField="ReportDate" HeaderText="Report Date" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="ReportDate" />


    <%-- <asp:DynamicField DataField="fldStatus" HeaderText="Status" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="fldStatus" />
    <asp:DynamicField DataField="fldReasonBy" HeaderText="StatusBy" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="fldReasonBy" />
    <asp:DynamicField DataField="fldReasonDate" HeaderText="StatusDate" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="fldReasonDate" />
    <asp:DynamicField DataField="StatusActionTaken" HeaderText="ActionTaken" ReadOnly="True" SortExpression="StatusActionTaken" />
    <asp:DynamicField DataField="fldExpectedDate" HeaderText="ExpectedBy" ItemStyle-Wrap="False" ReadOnly="True" SortExpression="fldExpectedDate" />--%>


    <asp:TemplateField HeaderText="Status" ItemStyle-Width="150" SortExpression="fldStatus">
    <EditItemTemplate>
    <asp:TextBox
    ID="txtStatusComment"
    runat="server"
    Width="150"
    Height="75"
    Wrap="true"
    Text='<%# Bind("fldStatus") %>'
    Font-Size="Small" TextMode="MultiLine" Font-Names="Calibri" />
    <asp:RequiredFieldValidator
    id="reqReason"
    Text="(Required)"
    Style="color: red; font-size: medium"
    ControlToValidate="txtStatusComment"
    Runat="server" >
    </asp:RequiredFieldValidator>
    <asp:CustomValidator
    id="valComments"
    ControlToValidate="txtStatusComment"
    Style="color: red; font-size: medium"
    Text="Comments must be less than 255 characters!"
    OnServerValidate="valComments_ServerValidate"
    Runat="server">
    </asp:CustomValidator>

    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label runat="server" ID="lbl2" Wrap="true" Text='<%# Bind("fldStatus")%>' Width="175" />
    </ItemTemplate>
    <ItemStyle Width="315px"></ItemStyle>
    </asp:TemplateField>


    <asp:TemplateField HeaderText="Status Date" SortExpression="fldReasonDate">
    <ItemTemplate>
    <asp:Label ID="ReasonDate" Runat="Server"
    Text='<%# Eval("fldReasonDate", "{0:d}") %>' />
    </ItemTemplate>
    </asp:TemplateField>

    <asp:BoundField DataField="fldReasonBy" HeaderText="Status By" SortExpression="fldReasonBy" ReadOnly="True" >
    <ItemStyle Width="50px" /></asp:BoundField>

    <asp:TemplateField HeaderText="Action Taken" SortExpression="fldActionTaken"><ItemStyle Width="75px" />
    <EditItemTemplate>
    <%-- <asp:DropDownList
    ID="ddlActionTaken"
    runat="server"
    Font-Name="Calibri"
    Font-Size="Small" />--%>

    <asp:DropDownList ID="ddlActionTaken" runat="server" Font-Name="Calibri" Font-Size="Small"></asp:DropDownList>

    <asp:RequiredFieldValidator
    id="reqActionTaken"
    ErrorMessage="(Required)"
    Style="color: red; font-size: medium"
    ControlToValidate="ddlActionTaken"
    Display="Dynamic"
    Runat="server">
    </asp:RequiredFieldValidator>

    <asp:CompareValidator
    id="cmpAction"
    Text="Select another option!"
    Style="color: red; font-size: medium"
    ControlToValidate="ddlActionTaken"
    ValueToCompare="0"
    Type="Integer"
    Operator="GreaterThan"
    Display="Dynamic"
    Runat="server">
    </asp:CompareValidator>

    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label ID="Label1" runat="server"></asp:Label>
    </ItemTemplate>

    </asp:TemplateField>

    <asp:TemplateField HeaderText="Expected Date" SortExpression="fldExpectedDate">
    <EditItemTemplate>
    <asp:TextBox ID="txtExpectedDate" class="ActionTakenDate" Text='<%# Bind("fldExpectedDate", "{0:d}") %>' runat="server" ReadOnly = "false" />

    <asp:RequiredFieldValidator
    id="reqActionTakenDate"
    Text="Required field! Format: mm/dd/yyyy"
    Style="color: red; font-size: medium"
    ControlToValidate="txtExpectedDate"
    Display="Dynamic"
    Runat="server">
    </asp:RequiredFieldValidator>

    <asp:CompareValidator
    id="cmpActionDate"
    runat="server"
    ControlToValidate="txtExpectedDate"
    Style="color: red; font-size: medium"
    Text="Format: mm/dd/yyyy"
    Operator="DataTypeCheck"
    Type="Date"
    Display="Dynamic">
    </asp:CompareValidator>
    <%-- <asp:RangeValidator
    id="ranActionDate"
    ControlToValidate="ActionTakenDate"
    Style="color: red; font-size: medium"
    Text='<%# Eval("fldReportAsOfDate", "The Action Date must occur between {0:d} and today.")%>'
    MinimumValue='<%# Eval("fldReportAsOfDate", "{0:d}") %>'
    MaximumValue="<%# DateTime.Today.ToShortDateString() %>"
    Type="Date"
    Runat="server" /> --%>
    </EditItemTemplate>
    <ItemTemplate>
    <asp:Label
    runat="server"
    id="lblActionTakeDate"
    Wrap="true"
    Text='<%# Bind("fldExpectedDate", "{0:d}")%>' />
    </ItemTemplate>
    </asp:TemplateField>

    </Columns>
    <RowStyle VerticalAlign="Top" />
    </asp:GridView>

    Thank you for any help you can give I am completely stuck

    Friday, April 17, 2020 9:36 PM

All replies

  • User-719153870 posted

    Hi Messenja,

    This issue can not be reproduced, we will need complete code related to this GridView.

    It seems your rowupdating method conficts with your rowdatabound event somehow.

    As for this error message, A public method with the name '' was either not found might give you some thoughts.

    Best Regard,

    Yang Shen

    Saturday, April 18, 2020 5:12 AM
  • User161939409 posted

    Oh thats a good place to start. I will look into that and post my code today!

    Monday, April 20, 2020 2:42 PM