asp.net.ph

GridViewRow.RowIndex Property

System.Web.UI.WebControls Namespace   GridViewRow Class


.NET Framework version 2.0

Returns the index of a GridViewRow in the Rows collection of a GridView control.

Syntax


Script [ integer variable = ] GridViewRow.RowIndex

Property Value


variable Integer specifying the ordinal position of the GridViewRow within the GridView control.

The property is read only with no default value.

Remarks

Use the RowIndex property to determine the index number of a GridViewRow from the Rows collection of a GridView control.

NOTE: This property applies only to data rows in the GridView control.

Example

The following example demonstrates how to use the RowIndex property to determine the position of a GridViewRow in a GridView control. The type of each row is displayed along with the row index.


foreach ( GridViewRow row in myGrid.Rows ) {
   msg.Text += "<br>" + row.RowIndex + " " + row.RowType;
}
  C# VB
Determining GridViewRow RowIndex and RowType
Run Sample | View Source
See Also

GridViewRow Members   RowType 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