Edit/Update a single GridView field
I've got a GridView on an ASP.NET page, on which I need to edit a single field in a row when a user clicks the 'Edit' button on that row, and have a SQL database table updated with whatever the user enters.
I'm added a CommandField to my GridVie开发者_Python百科w, so I now have an 'Edit' button at as the last column in each row. I'm getting the data from the database using LINQ.
My question is - how do I wire it so that when I click this 'Edit' button, the user is allowed to edit a single item in this row, then update the database with the text the user enters?
Any help is appreciated.
Thanks!
Set the fields you don't want to edit to read only:
<asp:BoundField DataField="CustomerName" HeaderText="CustomerName"
ReadOnly="True" SortExpression="CustomerName" />
Here are some Grid options for use with ASP.NET MVC:
grid controls for ASP.NET MVC?
精彩评论