asp.net.ph

HtmlTableCellCollection.Item Property

System.Web.UI.HtmlControls Namespace   HtmlTableCellCollection Class


Returns the table cell object at the specified index from the Cells collection.

In [ C# ], this property is the indexer for the HtmlTableCellCollection class.

[ VB ]
Public Default ReadOnly Property Item ( _
   ByVal index As Integer _
) As HtmlTableCell

[ C# ]
public HtmlTableCell this [ 
   int index
 ] {get;}

[ C++ ]
public: __property HtmlTableCell* get_Item (
   int index
);

[ JScript ]
returnValue=HtmlTableCellCollectionObject.Item ( index );
-or-
returnValue=HtmlTableCellCollectionObject ( index );

Parameters

index
An ordinal index value that specifies the table cell object to return.

Return Value

The specified HtmlTableCell control.

Remarks

Use this indexer to get an HtmlTableCell from the HtmlTableCellCollection. You can access an HtmlTableCell at a specified index by using simple array notation.

For example, if you have an HtmlTableCellCollection called myCellCollection, you can access the first element in the collection by using the following statement:

HtmlTableCell myCell = myCellCollection [ 0 ];
  C# VB

NOTE: The collection is zero-based, meaning the first element in the collection returns an index value of 0.

Example

The following example demonstrates how to use the indexer to retrieve a cell in the HtmlTableCellCollection. The cell is then updated with new content.

// iterate through the rows of the table
for ( int r = 0; r <= myTable.Rows.Count - 1; r++ ) {

   // iterate through the cells of a row
   for ( int c = 0; c <= myTable.Rows [ r ].Cells.Count - 1; c++ ) {

      // change the content of each cell
      myTable.Rows [ r ].Cells [ c ].InnerHtml = "Row " + r.ToString ( ) + 
         ", Column " + c.ToString ( ); 
   }
}
See Also

HtmlTableCellCollection Members Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note