Simple Insert, Select, Edit, Update and Delete in Asp. – The above block of codes in Row Updating event, finds the control in the Grid View, takes those values in pass it to the Customers Cls class Update method.

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.

In this tutorial we are searching for our Text Box controls txt Product Name and txt Unit Price.

Editing the Grid View control can be an incredibly easy feature to add for certain database tables, especially those who have no foreign key associated and can easily be edited through the use of a standard Text Box web control as shown in the figure below: 1.

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.

If user clicks the Cancel button while Grid View is in editing mode, you need to Cancel the Editing process and also need to reset the Edit Index property to -1 in the Row Canceling Edit event of the Grid View control as shown below: The last step is to handle the Row Updating event to actually update the back end database.

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.The secret lies in the event handlers–in this case, the Row Updating event handler. Grid View Update Event Args object that is passed in. This page contains copyright material from https://blog.and you have no rights to copy and paste the full text into your own blog even if you have written permission to the contrary. Using the Row Updating handler, we can do whatever we want. What the line of code says is “cancel any other update processing that may have happened after this event gets called.” From here on out, you’ll need to retrieve the values from your edit controls manually using the Find Contro By ID() method I demonstrated on Monday and updating the database using code. – For a while now I’m trying to figure out why my method, triggered by the Grid View. A Grid View Cancel Edit Event Args object is passed to the event-handling method, which enables you to determine the index of the current row and to indicate that the cancel operation should be stopped.event is raised when a row's Update button is clicked, but before the Grid View control updates the row.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. Thanks Thank you for writing this, after searching thru an unknown number of web sites, your tutorial had my issue resolved within 10 min!