asp.net.ph

DataGridColumnCollection.IndexOf Method

System.Web.UI.WebControls Namespace   DataGridColumnCollection Class


Returns the index of the specified DataGridColumn in the collection.

[ VB ]
Public Function IndexOf ( _
   ByVal column As Column _
) As Integer

[ C# ]
public int IndexOf (
   Column column
);

[ C++ ]
public: int IndexOf (
   Column* column
);

[ JScript ]
public function IndexOf (
   column : Column
) : int;

Parameters

column
The DataGridColumn to search for.

Return Value

The index of the specified DataGridColumn in the DataGridColumnCollection. The default value is -1, which indicates that the specified column object is not found.

Remarks

Use this method to determine the index number of a specified DataGridColumn derived object in the DataGridColumnCollection. If the specified DataGridColumn object is not found, an index of -1 is returned.

Example

The following example demonstrates how to use the IndexOf method to determine the index of a DataGridColumn derived object in a DataGridColumnCollection.

void getIndex ( Object src, EventArgs e ) {
   myLabel.Text = "The indexes of the columns: <br>";

   foreach ( DataGridColumn column in myGrid.Columns ) {
      myLabel.Text += column.HeaderText + " = " + 
         myGrid.Columns.IndexOf ( column ) + "<br>";
      }
}
  C# VB

See Also

DataGridColumnCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 Rey Nuñez All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note

You can help support asp.net.ph