| |||||||
HtmlTableRowCollection.Item PropertySystem.Web.UI.HtmlControls Namespace HtmlTableRowCollection Class Returns the table row object at the specified index from the Rows collection. In [ C# ], this property is the indexer for the HtmlTableRowCollection class. [ VB ] Public Default ReadOnly Property Item ( _ ByVal index As Integer _ ) As HtmlTableRow [ C# ] public HtmlTableRow this [ int index ] {get;} [ C++ ] public: __property HtmlTableRow* get_Item ( int index ); [ JScript ] returnValue=HtmlTableRowCollectionObject.Item ( index ); -or- returnValue=HtmlTableRowCollectionObject ( index ); Parameters
Return ValueThe specified HtmlTableRow control. RemarksUse this indexer to get an HtmlTableRow from the HtmlTableRowCollection. You can access an HtmlTableRow at a specified index by using simple array notation.
For example, to access the first element in the collection, use the following statement:
ExampleThe following example demonstrates how to use the indexer to refer to individual table row objects in the HtmlTableRowCollection. In this sample, a background color is applied to every other row. // iterate through the rows of the table
for ( int r = 0; r <= myTable.Rows.Count - 1; r++ ) {
// set the bgcolor only for alternate rows
if ( r%2 == 1 ) {
myTable.Rows [ r ].BgColor = "beige";
}
}
See AlsoHtmlTableRowCollection Members |
| ||||||
Check out related books at Amazon
© 2000-2008 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 aspxtreme