
EditCommandColumn | 853
WebControls
Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
items programmatically, use the Items collection or use the DataBind( ) method to bind to
a data source (such as a System.Data.DataTable or a System.Array).
Use the SelectedIndex property to determine the selected item or the SelectedItem property,
which returns a ListItem object that specifies the associated text.
Hierarchy
System.Object ➝ System.Web.UI.Control(System.ComponentModel.IComponent, System.
IDisposable, System.Web.UI.IParserAccessor, System.Web.UI.IDataBindingsAccessor)
➝
WebControl(System.Web.UI.IAttributeAccessor) ➝ ListControl ➝ DropDownList(System.
Web.UI.IPostBackDataHandler)
EditCommandColumn
System.Web.UI.WebControls (system.web.dll)
class
The EditCommandColumn class is a special type of column used with the DataGrid control. It
provides an “Edit” button or link (depending on the ButtonType property) that, when
clicked, fires the DataGrid.EditCommand event. This event allows you to initiate editing for a
row by using the DataGrid.EditItemIndex property (after which you must rebind to the data
source).
While editing is in progress, the EditCommandColumn displays “Cancel” and “Update”
buttons instead of an “Edit” button. These will trigger the DataGrid.CancelCommand and
DataGrid.UpdateCommand events, respectively. In these events, ...