How to create table programatically in C# ?

Samirbhogayta
Posted by Samirbhogayta under ASP.NET category on | Points: 40 | Views : 1016
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);

}

Comments or Responses

Login to post response