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.
Inline |
<asp:commandfield showeditbutton = true | false ... > |
Script |
CommandField.ShowEditButton [ = true | false ] |
This property accepts or returns only a boolean value: true to display an Edit button in a CommandField; otherwise, false. Default value is false.
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.
The following example demonstrates how to use the ShowEditButton property to display an Edit button in a DetailsView control.
Show me
CommandField Members ShowCancelButton ShowDeleteButton ShowInsertButton ShowSelectButton