By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,836 Members | 2,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,836 IT Pros & Developers. It's quick & easy.

GridView Update/Cancel not working

P: n/a
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>
<asp:Parameter Name="EmployeeID" Type="Int32" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
</UpdateParameters>
</asp:ObjectDataSource>

Feb 15 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.