This example shows how to edit and update records in a Grid View in ASP. This example is helpful in situations where an administrator needs to edit several records from the database.
For demonstration I have created a database (named Database.mdf) in which we have a table named tbl_Employee.
The Grid View control supports the following features:use Row Editing, Row Updating, Row Deleting, Row Command, Row Data Bound, Row Canceling Edit, and Pagination in a Data Grid.
You can also indicate whether the exception was handled in the event-handling method by setting the On Row Updated Row Canceling Edit On Row Canceling Edit Row Deleted On Row Deleted Row Deleting On Row Deleting Row Editing On Row Editing Row Updating On Row Updating Grid View Class System.
event is raised when a row's Update button is clicked, but before the Grid View control updates the row.
Note: I'm using stored procedure to update my DB table.
To manually specify columns for the gridview you have to set Auto Generate Columns="false".
event is raised when a row's Edit button is clicked, but before the Grid View control enters edit mode.
This enables you to provide an event-handling method that performs a custom routine, such as canceling the edit operation, whenever this event occurs.
This enables you to provide an event-handling method that performs a custom routine, such as canceling the update operation, whenever this event occurs.
A Grid View Update 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 update operation should be canceled.
Every one can use it to compare the new value with old ones.