System.Web.UI.WebControls Namespace DataGridColumnCollection Class
Returns a DataGridColumn object at the specified index in the collection.
In [ C# ], this property is the indexer for the DataGridColumnCollection class.
[ VB ]
Public Default ReadOnly Property Item ( _
ByVal index As Integer _
) As Column
[ C# ]
public Column this [
int index
] {get;}
[ C++ ]
public: __property Column* get_Item (
int index
);
[ JScript ]
returnValue=ColumnCollectionObject.Item ( index );
-or-
returnValue=ColumnCollectionObject ( index );
- index
- The zero-based index of the DataGridColumn to retrieve in the collection.
The DataGridColumn at the specified index in the collection.
Use this indexer to get a DataGridColumn derived object from the DataGridColumnCollection at the specified index using array notation.
The following example demonstrates how to use the indexer to get a DataGridColumn derived object from a DataGridColumnCollection.
void showHeaders ( Object src, EventArgs e ) {
myLabel.Text = "Header Text for each column: <br>";
for ( int i = 0; i < myGrid.Columns.Count; i ++ ) {
myLabel.Text += myGrid.Columns [ i ] .HeaderText + "<br>";
}
}
Sub Button_Click ( src As Object, e As EventArgs )
myLabel.Text = "Header Text for each column: <br>"
Dim i As Integer
For i = 0 To myGrid.Columns.Count - 1
myLabel.Text &= myGrid.Columns ( i ).HeaderText & "<br>"
Next i
End Sub |
|
C# |
VB |
DataGridColumnCollection Members