A
Al Wilkerson
Hey,
Below is some code to generate an HtmlTable dynamically, however the table
does not show on page.
When tracing through, the values from the database come out correctly, but
the table never displays.
Can anyone see anything that could possibly be the reason ?
Thanks,
t1 = new HtmlTable();
int maxrows = 0;
int maxcolumns = 0;
maxrows = ds.Tables["Products"].Rows.Count;
maxcolumns = ds.Tables["Products"].Columns.Count;
int row = 0;
for( int i = 0; i < maxrows - 1; i++)
{
HtmlTableRow r = new HtmlTableRow();
row = row + 1;
for( int j = 0; j < maxcolumns - 1; j++)
{
HtmlTableCell c = new HtmlTableCell();
c.Controls.Add(new
LiteralControl(Convert.ToString(ds.Tables["Products"].Rows.ItemArray[j])));
r.Cells.Add(c);
}
t1.Rows.Add(r);
}
t1.Visible = true;
Below is some code to generate an HtmlTable dynamically, however the table
does not show on page.
When tracing through, the values from the database come out correctly, but
the table never displays.
Can anyone see anything that could possibly be the reason ?
Thanks,
t1 = new HtmlTable();
int maxrows = 0;
int maxcolumns = 0;
maxrows = ds.Tables["Products"].Rows.Count;
maxcolumns = ds.Tables["Products"].Columns.Count;
int row = 0;
for( int i = 0; i < maxrows - 1; i++)
{
HtmlTableRow r = new HtmlTableRow();
row = row + 1;
for( int j = 0; j < maxcolumns - 1; j++)
{
HtmlTableCell c = new HtmlTableCell();
c.Controls.Add(new
LiteralControl(Convert.ToString(ds.Tables["Products"].Rows.ItemArray[j])));
r.Cells.Add(c);
}
t1.Rows.Add(r);
}
t1.Visible = true;