If you are using command buttons, then do not use Auto Generate Edit Button.
A datakey represents the primary key field or field of a record that can uniquely identify it in a data-bound control. Row Index represents the index of the particular row.
By default all the boundfields will be trasferred as Textboxes in Edit Mode.
To avoid this we need to keep the property Read Only as false, Then in the edit mode nothing will happenes. The reason I use Template Field instead of Bound Field is that, it is very easy to grab those controls in the codebehind if we user labels or textboxes.
event is raised when a button is clicked in the Grid View control.
event is raised when a button listed in the previous table is clicked, it is recommended that you use the events listed in the table for the operation.Secondly if you want to include a custom field (some button or link) in the same column it’s not possible.If we use proper command names for the buttons like “EDIT”, “DELETE”, “UPDATE”, “CANCEL” these will also trigger the appropriate Grid View Events.Suppose if we are trying to hide primary key of our table, there is actually no need to hide. In the above Snippet you are seeing a label in Item Template that means whenever we are showing Grid View to the user Label will be visible to the user. We will use Template Field, whenever we want to define some custom control in the data bound controls like Grid View, Data Grid or Data Repeater.