System.Web.UI.WebControls Namespace TableCellCollection 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 TableCell _
)
[ C# ]
public void Insert (
int index,
TableCell cell
);
[ C++ ]
public: void Insert (
int index,
TableCell* cell
);
[ JScript ]
public function Insert (
index : int,
cell : TableCell
);
- 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 TableCell to a TableCellCollection at the specified index. If you want to simply append a TableCell to the end of the collection, use the Add method instead.
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
TableCell cell = new TableCell ();
// 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
TableCellCollection Members