Programatically create a table using c#
Posted
by
Samir R. Bhogayta
on Samir ASP.NET with C# Technology
See other posts from Samir ASP.NET with C# Technology
or by Samir R. Bhogayta
Published on 2013-09-11T14:41:00.004+05:30
Indexed on
2013/10/17
16:21 UTC
Read the original article
Hit count: 156
Filed under:
Table tbl = new Table();
tbl.ID = "table1";
this.Controls.Add(tbl);
for (int row = 0; row < 5; row++)
{
TableRow rw = new TableRow();
TableCell cell = new TableCell();
Label text = new Label();
text.Text = "text";
cell.Controls.Add(text);
rw.Cells.Add(cell);
tbl.Controls.Add(rw);
}
tbl.ID = "table1";
this.Controls.Add(tbl);
for (int row = 0; row < 5; row++)
{
TableRow rw = new TableRow();
TableCell cell = new TableCell();
Label text = new Label();
text.Text = "text";
cell.Controls.Add(text);
rw.Cells.Add(cell);
tbl.Controls.Add(rw);
}
© Samir ASP.NET with C# Technology or respective owner