I'm having a hard time figuring out a problem I have been stuck with for two days now.
I'm developing a web project which contains a gridview, that should have a edit/update function.
First off I have have a method that returns a datatable that varies in size from time to time. Getting data from different database tables.
This method is the select method for the datasource, and it works fine.
Then I've added a Command field: Edit, Update, Cancel to the gridview and created a simple test update method that just change the text of a label on the page.
Added this update method to the datasource, but just cant get this to work.
On the datasource, the DataObjectTypeName is set to: System.Web.UI.WebControls.
When I click on the update link, the following error message is produced:
No parameterless constructor defined for this object.
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.MissingMethodExcept
ion: No parameterless constructor defined for this object.
I haven't really worked that much with gridviews and datasources, but how does the update method get the correct row, the one that are being edited?
And I guess this is related to my problem?
public void UpdateGridView(GridViewRow test)
Label1.Text = "Updated! ";
//The gridview and datasource
<asp:GridView ID="gwSelectedForm" runat="server" DataSourceID="ObjectDataSource1"
<asp:CommandField ShowEditButton="True" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
<asp:ControlParameter ControlID="ddlFormAccess" DefaultValue="" Name="lookup"
PropertyName="SelectedValue" Type="String" />