DetailsView.AutoGenerateDeleteButton Property
Assembly: System.Web (in system.web.dll)
public: virtual property bool AutoGenerateDeleteButton { bool get (); void set (bool value); }
/** @property */ public boolean get_AutoGenerateDeleteButton () /** @property */ public void set_AutoGenerateDeleteButton (boolean value)
public function get AutoGenerateDeleteButton () : boolean public function set AutoGenerateDeleteButton (value : boolean)
Property Value
true to display the built-in control to delete the current record; otherwise, false. The default is false.When a DetailsView control is bound to an object that inherits from DataSourceView and the CanDelete property returns true, the DetailsView control can take advantage of the data source control's capabilities and provide automatic deleting functionality.
Note |
|---|
| For a SqlDataSourceView object to delete data, the SqlDataSource.DeleteCommand property of the underlying SqlDataSource object must be set with a delete query statement. |
When the AutoGenerateDeleteButton property is set to true, a CommandField row field with a Delete button is automatically displayed in the DetailsView control. Clicking the Delete button permanently removes that record from the data source.
Note |
|---|
| You must also set the DataKeyNames property for the automatic deletion feature to work. |
The DetailsView control provides several events that you can use to perform a custom action when a record is deleted. The following table lists the available events.
| Event | Description |
|---|---|
| Occurs when the Delete button is clicked, but after the DetailsView control deletes the record from the data source. This event is often used to check the results of the delete operation. | |
| Occurs when the Delete button is clicked, but before the DetailsView control deletes the record from the data source. This event is often used to cancel the delete operation. |
The value of AutoGenerateDeleteButton is stored in view state.
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.
Note