asp.net.ph

CommandField.ShowDeleteButton Property

System.Web.UI.WebControls Namespace   CommandField Class


.NET Framework version 2.0

Sets or retrieves a value indicating whether a Delete button is displayed in a CommandField.

Syntax


Inline <asp:commandfield showdeletebutton = true | false ... >
Script CommandField.ShowDeleteButton [ = true | false ]

Property Value

This property accepts or returns only a boolean value: true to display a Delete button in a CommandField; otherwise, false. Default value is false.

Remarks

Use the ShowDeleteButton property to specify whether a Delete button is displayed for each data row in a CommandField control.

Clicking the Delete button for a row permanently removes that record from the data source.

Note that for the automatic delete feature to work, the CommandField 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 of the parent control must be set to specify the key field or fields of the data source that will identify the record to delete.

When the ButtonType property of a CommandField is set to Button or Link, use the DeleteText property to specify the text to display for a Delete button.

Alternatively, you can display an image by first setting the ButtonType property to Image and then setting the DeleteImageUrl property.

Example

The following example demonstrates how to use the ShowDeleteButton property to display a Delete button in a DetailsView control.

 Show me 

See Also

CommandField Members   ShowCancelButton   ShowEditButton   ShowInsertButton   ShowSelectButton 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