T
tim.cavins
I am trying a GridView for the first time and it seems to be something
that should be EXTREMELY simple.
I cannot get the Update or Cancel when trying to edit a row to work.
When I click on the Edit link, the row comes up in Edit mode. That's
as far as it goes. If I change a value in a textbox and click Update,
the page reloads still in edit mode but the original values appear in
the textboxes.
Also, the Cancel button does not work either and the row remains in
edit mode after clicking cancel.
Here is my code. It is probably something simple that I am
overlooking...
Any help is appreciated.
Tim
<asp:GridView ID="gvEmployees" runat="server"
DataSourceID="odsTemplate" CssClass="DataGrid"
AutoGenerateColumns="False" DataKeyNames="EmployeeID" >
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsTemplate" runat="server"
SelectMethod="SelectGridView"
TypeName="App_BL.TemplateSample" UpdateMethod="UpdateGridView">
<UpdateParameters>
<asparameter Name="EmployeeID" Type="Int32" />
<asparameter Name="FirstName" Type="String" />
<asparameter Name="LastName" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>
that should be EXTREMELY simple.
I cannot get the Update or Cancel when trying to edit a row to work.
When I click on the Edit link, the row comes up in Edit mode. That's
as far as it goes. If I change a value in a textbox and click Update,
the page reloads still in edit mode but the original values appear in
the textboxes.
Also, the Cancel button does not work either and the row remains in
edit mode after clicking cancel.
Here is my code. It is probably something simple that I am
overlooking...
Any help is appreciated.
Tim
<asp:GridView ID="gvEmployees" runat="server"
DataSourceID="odsTemplate" CssClass="DataGrid"
AutoGenerateColumns="False" DataKeyNames="EmployeeID" >
<Columns>
<asp:BoundField DataField="FirstName" HeaderText="First Name" />
<asp:BoundField DataField="LastName" HeaderText="Last Name" />
<asp:CommandField ShowEditButton="True" />
</Columns>
</asp:GridView>
<asp:ObjectDataSource ID="odsTemplate" runat="server"
SelectMethod="SelectGridView"
TypeName="App_BL.TemplateSample" UpdateMethod="UpdateGridView">
<UpdateParameters>
<asparameter Name="EmployeeID" Type="Int32" />
<asparameter Name="FirstName" Type="String" />
<asparameter Name="LastName" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>