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.
Script |
[ integer variable = ] GridViewRow.RowIndex |
variable |
Integer specifying the ordinal position of the GridViewRow within the GridView control. |
The property is read only with no default value.
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.
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;
}
dim row as GridViewRow
for each row in myGrid.Rows
msg.Text &= "<br>" & row.RowIndex & " " & row.RowType
next |
|
C# |
VB |
GridViewRow Members RowType