1

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 GridView, 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!

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
Jimmy Collins
  • 3,294
  • 5
  • 39
  • 57

2 Answers2

1

Set the fields you don't want to edit to read only:

            <asp:BoundField DataField="CustomerName" HeaderText="CustomerName" 
            ReadOnly="True" SortExpression="CustomerName" />
Steve Wellens
  • 20,506
  • 2
  • 28
  • 69
0

Here are some Grid options for use with ASP.NET MVC:

grid controls for ASP.NET MVC?

Community
  • 1
  • 1
IrishChieftain
  • 15,108
  • 7
  • 50
  • 91