ASP.NET.in.a.Nutshell.Second.Edition [Electronic resources]

G. andrew Duthie; matthew Macdonald

نسخه متنی -صفحه : 873/ 720
نمايش فراداده

ButtonColumn

System.Web.UI.WebControls (system.web.dll)class

The ButtonColumn class represents a type of column that can be used in a DataGrid control. This column consists of buttons that raise the DataGrid.ItemCommand event. These buttons can be displayed as graphical push buttons (like Button) or text links, depending on the ButtonType property.

The Text property determines what text is displayed for the button, while the CommandName property specifies a string of additional information that will be sent to the DataGrid.ItemCommand event through the DataGridCommandEventArgs object.

If you set the Text and CommandName properties, all buttons in the column will share the same information. Alternatively, you can set the DataTextField property to use data binding and the DataTextFormatString property to specify formatting rules.

public class 

ButtonColumn : DataGridColumn { // Public Constructors public

ButtonColumn ( ); // Public Instance Properties public virtual ButtonColumnType

ButtonType {set; get; } public virtual string

CommandName {set; get; } public virtual string

DataTextField {set; get; } public virtual string

DataTextFormatString {set; get; } public virtual string

Text {set; get; } // Public Instance Methods public override void

Initialize ( ); // overrides DataGridColumn public override void

InitializeCell (TableCell

cell , int

columnIndex , ListItemType

itemType ); // overrides DataGridColumn // Protected Instance Methods protected virtual string

FormatDataTextValue (object

dataTextValue ); }

Hierarchy

System.Object DataGridColumn(System.Web.UI.IStateManager) ButtonColumn