asp.net.ph

DataControlFieldCollection.IndexOf Method

System.Web.UI.WebControls Namespace   DataControlFieldCollection Class


.NET Framework version 2.0

Returns the index of the specified DataControlField 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 DataControlField to search for.

Return Value

The index of the specified DataControlField in the DataControlFieldCollection. 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 DataControlField derived object in the DataControlFieldCollection. If the specified DataControlField 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 DataControlField derived object in a DataControlFieldCollection.

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

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

See Also

DataControlFieldCollection 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