• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

Error when updating datagridview in asp.net

i have 3 gridviews. when i select the first gridview the second one comes visible and when i select the second one it will select the third one. The problem is when the second gridview: when i try to update the data it gives the following error:
 Exception message: Exception of type 'System.Web.HttpUnhandledException' was thrown.

Inner exception: System.InvalidOperationException: ObjectDataSource 'dsContractePos' could not find a non-generic method 'CONTRACTEPOS_UPD' that has parameters: CONTRACTID, ARTICOLID, cantmin, cantmax, pretftva, CANTITATE_MIN, CANTITATE_MAX, PRETFARATVA, contractposid.%0d%0a at System.Web.UI.WebControls.ObjectDataSourceView.GetResolvedMethodData(Type type, String methodName, IDictionary allParameters, DataSourceOperation operation)%0d%0a at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteUpdate(IDictionary keys, IDictionary values, IDictionary oldValues)%0d%0a at System.Web.UI.DataSourceView.Update(IDictionary keys, IDictionary values, IDictionary oldValues, DataSourceViewOperationCallback callback)%0d%0a at System.Web.UI.WebControls.GridView.HandleUpdate(GridViewRow row, Int32 rowIndex, Boolean causesValidation)%0d%0a at System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)%0d%0a at System.Web.UI.WebControls.GridView.OnBubbleEvent(Object source, EventArgs e)%0d%0a at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)%0d%0a at System.Web.UI.WebControls.GridViewRow.OnBubbleEvent(Object source, EventArgs e)%0d%0a at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)%0d%0a at System.Web.UI.WebControls.ImageButton.OnCommand(CommandEventArgs e)%0d%0a at System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String eventArgument)%0d%0a at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)%0d%0a at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)%0d%0a at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)%0d%0a at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

i tried to recreate the SP and the function in the controller, but without luck.

thanks advanced.
0
Molnar István
Asked:
Molnar István
  • 3
1 Solution
 
informaniacCommented:
Please show us the objectdatasource code
0
 
Molnar IstvánHelpDesk / ProgrammerAuthor Commented:
Objectdatasource:
<asp:ObjectDataSource ID="dsContractePos" runat="server" 
    SelectMethod="CONTRACTEPOS_GET" 
    TypeName="IDEAL.WM.Controllers.ContracteController" 
    UpdateMethod="CONTRACTEPOS_UPD">
    <SelectParameters>
        <asp:ControlParameter ControlID="gvContracte" DefaultValue="-1" 
            Name="contractid" PropertyName="SelectedValue" Type="Int32" />
    </SelectParameters>
    <UpdateParameters>
        <asp:Parameter Name="contractposid" Type="Int32" />
        <asp:Parameter Name="contractid" Type="Int32" />
        <asp:Parameter Name="articolid" Type="Int32" />
        <asp:Parameter Name="cantmin" Type="Decimal" />
        <asp:Parameter Name="cantmax" Type="Decimal" />
        <asp:Parameter Name="pretftva" Type="Decimal" />
    </UpdateParameters>
</asp:ObjectDataSource>

Open in new window


Code:
dsContractePos.UpdateParameters.Clear();
                    dsContractePos.UpdateParameters.Add("ARTICOLID", articoleddl.SelectedValue);
                    dsContractePos.UpdateParameters.Add("CANTITATE_MIN", cantmintxt.Text);
                    dsContractePos.UpdateParameters.Add("CANTITATE_MAX", cantmaxtxt.Text);
                    dsContractePos.UpdateParameters.Add("PRETFARATVA", pretftvatxt.Text);
                    dsContractePos.UpdateParameters.Add("contractposid", e.CommandArgument.ToString());
                    dsContractePos.UpdateParameters.Add("CONTRACTID", gvContractePos.DataKeys[gvContractePos.EditIndex]["CONTRACTID"].ToString());

Open in new window

0
 
Molnar IstvánHelpDesk / ProgrammerAuthor Commented:
i have found the problem:
-i recreated the table and the SP in the database
-i modified the following in the aspx page:
<UpdateParameters>
        <asp:Parameter Name="contractid" Type="Int32" />
        <asp:Parameter Name="partenerid" Type="Int32" />
        <asp:Parameter Name="datastart" Type="DateTime" />
        <asp:Parameter Name="dataend" Type="DateTime" />
        <asp:Parameter Name="datareziliere" Type="DateTime" />
        <asp:Parameter Name="stareid" Type="Int32" />
        <asp:Parameter Name="tipcontractid" Type="Int32" />
        <asp:Parameter Name="datacontract" Type="DateTime" />
    </UpdateParameters>
0
 
Molnar IstvánHelpDesk / ProgrammerAuthor Commented:
i have found the solution myself
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now