Click to See Complete Forum and Search --> : Adding a new row to a table when a button is pressed


Funkymonkey
08-31-2005, 05:38 AM
I have a table and when a button is clicked a new row is added to the table. The row is added to the bottom of the table. Can I make the new row be added to the middle of the table??

Thanks

Gert
09-01-2005, 12:03 AM
HtmlTable has a property called "rows" that returns an HtmlTableRowCollection. If you look at HtmlTableRowCollection in a class browser, you will see that it has an insert method that looks like this:

public void Insert(int index, HtmlTableRow row);

So you'd probably do HtmlTable.Rows.Insert(4, HtmlTableRowInstance)

if you don't have web matrix already, you should get it - the class browser is searchable and very handy.

Hope that helps.

Funkymonkey
09-01-2005, 03:57 AM
Thank you loads! I thought it would be something really difficult but now it all works and I only had to change 2 things!

Thanks!

Gert
09-01-2005, 07:38 PM
no problem.