You need to include the Grid View Command Field column to add Edit, Update and Cancel Buttons in the Grid View. You need to include Template Field for every column you want to provide Editing because Template Field provides you both Item Template and Edit Item Template to create interface for two separate Grid View modes. You need to handle Grid View events such as Row Editing, Row Canceling Edit and Row Updating to provide desired editing functionality.
Font-Names="Verdana" Font-Size="10" Data Key Names="Product ID" Auto Generate Columns="false" onrowcancelingedit="Grid View1_Row Canceling Edit" onrowediting="Grid View1_Row Editing" onrowupdating="Grid View1_Row Updating"In the above code, I set two properties Show Edit Button and Show Cancel Button of Command Field.
To do this we first need to obtain the reference of the current row by using its index no as shown in the first line below.
By using the Grid View Row object we can find the reference of any control in the row in which user is editing the data.
Next event is the Grid View Row Editing event to give ASP. You need to set the Edit Index property of the Grid View with the New Edit Index property of the Grid View Edit Event Args class.