Simplified Question:
I want to use the following to build an html table dynamically.
//table.Rows[row].Cells.AddRange(new TableCell[] { new TableCell(), new TableCell(), new TableCell(), new TableCell(), new TableCell(), new TableCell() });
for (int row = 0; row < intRows; row++)
{
table.Rows.Add(new TableRow());
table.Rows[row].Cells.AddRange(new TableCell[intCellsPerRow]);
intTableRows = row;
}
I used the commented line before, but it is not flexible, so is not what I want.
The Line: table.Rows[row].Cells.AddRange(new TableCell[intCellsPerRow]);
does not work.
How can I get this to work?
Answer Thanks to Heinzi
for (int row = 0; row < dtStructure.Rows.Count / TABLE_COLUMNS; row++)
{
table.Rows.Add(new TableRow());
for (int i = 0; i < CELLS_PER_COLUMN * TABLE_COLUMNS; i++)
{
table.Rows[row].Cells.Add(new TableCell());
}
intTableRows = row;
}