asp.net.ph

TableCellCollection.Insert Method

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
);

Parameters

index
The location in the collection at which to add the table cell.
cell
The table cell object to add to the collection.

Remarks

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.

Example

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 

See Also

TableCellCollection Members Skip Navigation Links




Home
Suggested Reading


Previous page Back to top Next page

© 2000-2010 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 asp.net.ph