Export (0) Print
Expand All

ButtonColumn Class

A column type for the DataGrid control that contains a user-defined command button, such as Add or Remove, that corresponds with each row in the column.

For a list of all members of this type, see ButtonColumn Members.

System.Object
   System.Web.UI.WebControls.DataGridColumn
      System.Web.UI.WebControls.ButtonColumn

[Visual Basic]
Public Class ButtonColumn
   Inherits DataGridColumn
[C#]
public class ButtonColumn : DataGridColumn
[C++]
public __gc class ButtonColumn : public DataGridColumn
[JScript]
public class ButtonColumn extends DataGridColumn

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

Use the ButtonColumn column type in a DataGrid control to create a command button that corresponds with each row in the DataGrid control. Specify the caption displayed in the command buttons by setting the Text property.

Note   If you set the Text property, all command buttons in the column share the same caption.

Alternatively, you can bind the ButtonColumn column to a field in a data source. This allows you to display different captions for the command buttons in the column. The values in the specified field are used for the text caption. Set the DataTextField property to bind the column to a field in a data source.

You can format the captions displayed in the command buttons by setting the DataTextField property with a formatting string.

Clicking on the command buttons in the column raises the ItemCommand event. You can programmatically control the action performed when the command button is clicked by providing an event handler for the ItemCommand event.

Note   Unlike regular button controls, validation in not performed when the buttons in the ButtonColumn are clicked. To create a column with buttons that perform validation when clicked, add a button control, such as Button or LinkButton, to a TemplateColumn.

Requirements

Namespace: System.Web.UI.WebControls

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

Assembly: System.Web (in System.Web.dll)

See Also

ButtonColumn Members | System.Web.UI.WebControls Namespace | DataGrid | DataGridColumn | BoundColumn | EditCommandColumn | HyperLinkColumn | TemplateColumn | Button | LinkButton

Show:
© 2014 Microsoft