System.Web.UI.WebControls Namespace CommandField Class
.NET Framework version 2.0
Sets or retrieves a value indicating whether a Select button is displayed in a CommandField.
Inline |
<asp:commandfield showselectbutton = true | false ... > |
Script |
CommandField.ShowSelectButton [ = true | false ] |
This property accepts or returns only a boolean value: true to display a Select button in a CommandField; otherwise, false. Default value is false.
Use the ShowSelectButton property to specify whether a Select button is displayed for each data row in a CommandField control.
NOTE: This property applies only to data-bound controls that support select operations, such as the GridView control.
Clicking the Select button for a row selects that record from the data source, and sets the SelectedIndex property to the index of the row, and also sets a reference to the selected GridViewRow object via the SelectedRow property.
Note that for the automatic select feature to work, the DataKeyNames property must be set to specify the key field or fields of the data source that will identify the record to select.
When the ButtonType property of a CommandField is set to Button or Link, use the SelectText property to specify the text to display for a Select button.
Alternatively, you can display an image by first setting the ButtonType property to Image and then setting the SelectImageUrl property.
CommandField Members ShowCancelButton ShowEditButton ShowInsertButton ShowSelectButton