asp.net.ph

CommandField.ShowEditButton Property

System.Web.UI.WebControls Namespace   CommandField Class


.NET Framework version 2.0

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

Syntax


Inline <asp:commandfield showeditbutton = true | false ... >
Script CommandField.ShowEditButton [ = true | false ]

Property Value

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

Remarks

Use the ShowEditButton property to specify whether an Edit button is displayed for each data row in a CommandField control.

Clicking the Edit button for a row puts the control into edit mode, and input controls are displayed for each field in the record, allowing the user to edit the values for the record. The Edit button for the record is replaced with an Update button and a Cancel button, and all other command buttons for the record are hidden. Clicking the Update button updates the record with the new values in the data source, whereas clicking the Cancel button cancels the operation.

Note that for the automatic edit feature to work, the CommandField must be bound to a data source control that is configured to edit data, meaning the UpdateCommand 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 edit.

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

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

Example

The following example demonstrates how to use the ShowEditButton property to display an Edit button in a DetailsView control.

 Show me 

See Also

CommandField Members   ShowCancelButton   ShowDeleteButton   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