System.Web.UI.WebControls Namespace ButtonField Class
.NET Framework version 2.0
Initializes a new instance of the ButtonField class.
[ VB ]
Public Sub New ( )
[ C# ]
public ButtonField ( );
[ C++ ]
public: ButtonField ( );
[ JScript ]
public function ButtonField ( );
Use this constructor to initialize a new instance of the ButtonField class.
The following example demonstrates how to initialize a new instance of the ButtonField class and add it to the Columns collection.
void Page_Init ( Object src, EventArgs e ) {
// create dynamic column to add to Columns collection.
ButtonField newColumn = new ButtonField ( );
newColumn.HeaderText = "Add Item";
newColumn.Text = "Add";
newColumn.CommandName = "Add";
// add column to Columns collection.
myGrid.Columns.AddAt ( 2, newColumn );
}
Sub Page_Init ( src As Object, e As EventArgs )
' create dynamic column to add to Columns collection.
Dim newColumn As New ButtonField ( )
newColumn.HeaderText = "Add Item"
newColumn.Text = "Add"
newColumn.CommandName = "Add"
' add column to Columns collection.
myGrid.Columns.AddAt ( 2, newColumn )
End Sub |
|
C# |
VB |
ButtonField Members Adding Button Fields to a GridView Control