Adding a table dynamically in code behind I can do something like...
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
cell1.Text = "blah blah blah";
row.Cells.Add(cell1);
myTable.Rows.Add(row);
but what if the order of the table rows depends on the user input....so for each iteration it is either going to be A or B. If it is A, extend row a...If it is B, extend row b
after 1st iteration
A: 123
after 2nd iteration
A: 123
B: abc
after 3rd iteration
A: 123456
B abc
after 4th iteration
A: 123456789
B: abc
Ive tried rows.addAt(index, row); but its not working says index is out of range. is this even the correct way to do this? thanks for any replies
//forloop
{
if(A)
{
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
cell1.Text = "blah blah blah";
row.Cells.Add(cell1);
myTable.Rows.AddAt(0, row);
}
if(B)
{
TableRow row = new TableRow();
TableCell cell1 = new TableCell();
cell1.Text = "blah blah blah";
row.Cells.Add(cell1);
myTable.Rows.Add(1, row);
}