views:

537

answers:

3

I want to add a few dynamic rows right in the middle of a table which is otherwise defined in static markup. Unfortunately, Web.UI.Table has no exposed AddAt method.

It looks like I can dynamically AddAt on a Web.UI.ControlCollection, and it looks like internally, Web.UI.WebControls.Table has a RowControlCollection.AddAt method, but MSDN says that it's "not intended to be used directly from your code". Is this safe, will it work?

An alternative approach is to just nest another table inside a single placeholder TableRow, but the table is used for position/style :( so nesting a table in a row is going to cause major style problems.

A: 

I'm not sure if MSDN is contradicting itself or not, but Table.Rows.AddAt == TableRowCollection.AddAt which is perfectly acceptable.

Dustin Getz
+1  A: 

you can use _table.Rows.Insert(index,row)

Ali
A: 

for the record, this got annoying, so i added a little design complexity to avoid this requirement.

Dustin Getz