event is raised when a row's Update button is clicked, but before the Grid View control updates the row.This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.In the above tutorial I tried to give you one of the easiest solutions and I hope you can go explore Grid View control editing further after learning the basics from this tutorial.A friend asked me to help him out on this and frankly it has me completely stumped as well.
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.
In the Page_Load event, you simply load your data from the database and bind it with the Grid View control as shown below: For brevity I am not storing connection string in the web.config and also not using any Data Access Component.
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.
I am using Template Field’s Item Template and Edit Item Template for providing read only and editing interface of the same column in the Grid View.
By Default, Grid View control displays Item Template which directly shows the Product Name and Unit Price columns but when user clicks Edit button Grid View automatically switches to Edit Item Template and display the control available inside Edit Item Template for user editing.