asp.net.ph

DetailsView.AutoGenerateDeleteButton Property

System.Web.UI.WebControls Namespace   DetailsView Class


.NET Framework version 2.0

Sets or retrieves a value specifying whether the built-in control to delete a record is automatically added and displayed in a DetailsView control.

Syntax


Inline <asp:detailsview autogeneratedeletebutton = true | false ... >
Script DetailsView.AutoGenerateDeleteButton [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true if the built-in controls to delete a record is automatically added and displayed; otherwise, false. Default value is false.

Remarks

Use this property to specify whether the built-in control to delete a record are automatically added and displayed in a DetailsView control.

Note that for the automatic delete feature to work, the DetailsView must be bound to a data source control that is configured to delete data, meaning the DeleteCommand must have been properly set.

In addition, the DataKeyNames property must be set to specify the key field or fields of the data source that will identify the record to delete.

The DetailsView control raises the following events to which you can assign a custom action to perform when a row is deleted.

Event Description
ItemDeleteed Occurs when the Delete button is clicked, but after the DetailsView control deletes the record. This event is often used to check the results of the delete operation.
ItemDeleting Occurs when the Delete button is clicked, but before the DetailsView control updates the record. This event is often used to cancel the delete operation.
ModeChanged Occurs after the DetailsView control changes modes.
ModeChanging Occurs before the DetailsView control changes modes. This event is often used to cancel the mode change.

Example

The following example demonstrates how to use the AutoGenerateDeleteButton property to display the built-in controls to delete a record in a DetailsView control.

WARNING: Deleting rows in a database table CANNOT BE UNDONE, which can result in serious data loss. In a real-world scenario, only the database administrator or an authorized user must be granted DELETE permission. The examples provided here are only for learning purposes.

 Show me 

See Also

DetailsView Members   AutoGenerateEditButton   AutoGenerateInsertButton   Allowing Users to Delete Rows in a DetailsView Control Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph