System.Web.UI.HtmlControls Namespace HtmlTableCellCollection Class
Adds the specified table cell object to the end of the Cells collection.
[ VB ]
Public Sub Add ( _
ByVal cell As HtmlTableCell _
)
[ C# ]
public void Add (
HtmlTableCell cell
);
[ C++ ]
public: void Add (
HtmlTableCell* cell
);
[ JScript ]
public function Add (
cell : HtmlTableCell
);
- cell
- The table cell object to add to the collection.
Use this method to add the specified HtmlTableCell to the end of an HtmlTableCellCollection. If you need to insert an HtmlTableCell in a specified location in the collection, use the Insert method.
The following example demonstrates how to use the Add method to append a new cell to the end of the Cells collection.
// loop through the given number of cells
for ( int c = 0; c < numcells; c++ ) {
// instantiate a new cell
HtmlTableCell cell = new HtmlTableCell ( );
// add cell content
cell.Controls.Add ( new LiteralControl ( "row " + r.ToString ( ) +
", cell " + c.ToString ( ) ) );
// add the cell to the Cells collection
row.Cells.Add ( cell );
}
Show me
HtmlTableCellCollection Members