System.Web.UI.HtmlControls Namespace HtmlTableCellCollection Class
Adds a table cell object at a specified index location in the Cells collection.
[ VB ]
Public Sub Insert ( _
ByVal index As Integer, _
ByVal cell As HtmlTableCell _
)
[ C# ]
public void Insert (
int index,
HtmlTableCell cell
);
[ C++ ]
public: void Insert (
int index,
HtmlTableCell* cell
);
[ JScript ]
public function Insert (
index : int,
cell : HtmlTableCell
);
- index
- The location in the collection at which to add the table cell.
- cell
- The table cell object to add to the collection.
Use the Insert method to add the specified HtmlTableCell to an HtmlTableCellCollection at the specified index. If you need to simply append an HtmlTableCell to the end of the collection, use the Add method.
The following example demonstrates how to use the Insert method to dynamically insert a table cell at a specified index in 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 ( ) ) );
// insert the cell to the Cells collection
row.Cells.Insert ( c, cell );
}
Show me
HtmlTableCellCollection Members