Assembly: System.Web (in System.Web.dll)
When a data source control that supports deleting is bound to a GridView control, the GridView control can take advantage of the data source control's capabilities and provide automatic deleting functionality.
For a data source control to delete data, it must be configured to delete data. To configure a data source control to delete records, see the documentation for the specific data source control.
When the property is set to true, a column (represented by a CommandField object) with a Delete button for each data row is automatically added to the GridView control. Clicking the Delete button for a row permanently removes that record from the data source.
You must also set the DataKeyNames property to identify the key field or fields of the data source for the automatic deleting feature to work.
The GridView control provides several events that you can use to perform a custom action when a row is deleted. The following table lists the available events.
Occurs when a row's Delete button is clicked, but after the GridView control deletes the record from the data source. This event is often used to check the results of the delete operation.
Occurs when a row's Delete button is clicked, but before the GridView control deletes the record from the data source. This event is often used to cancel the deleting operation.