asp.net.ph

HtmlTableRowCollection.Count Property

System.Web.UI.HtmlControls Namespace   HtmlTableRowCollection Class


Returns the number of table row objects in the HtmlTable.Rows collection.

Syntax


Script [ integer intVar = ] Rows.Count

This property can only be used programmatically; it cannot be set when declaring the control.

Property Value


intVar Integer object representing the number of rows in the collection.

The property is read-only with no default value.

Remarks

Use the Count property to determine the number of HtmlTableRow objects contained in the HtmlTableRowCollection. Count is commonly used to set the upper bound of a loop when iterating through the items of the collection.

Example

The following example demonstrates how to use the Count property to determine the number of rows in an HtmlTable. This value is then used as the upper bound of a loop that iterates through each row in the table.

// iterate through the rows of the table
for ( int r = 0; r <= myTable.Rows.Count - 1; r++ ) {
   // do something to each row here, such as set the bgcolor
   myTable.Rows [ r ].BgColor = "khaki";
}
See Also

HtmlTableRowCollection 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