Code Snippet posted by:
Arul44ece | Posted on: 10/11/2012 | Category:
C# Codes | Views: 598 | Status:
[Member] |
Points: 40
|
Alert Moderator
The below code used to create text box and table dynamically.
Table tb = new Table();
tb.BorderWidth = Unit.Pixel(5);
for (int i = 1; i <= Convert.ToInt32(TextBox1.Text ); i++)
{
TableRow tr = new TableRow();
for (int j = 1; j <= 3; j++)
{
TableCell td = new TableCell();
TextBox c_text = new TextBox();
c_text.Visible = true;
c_text.Text = "R"+i.ToString()+j.ToString();
c_text.ID = "R" + i.ToString() + j.ToString();
td.Controls.Add(c_text);
tr.Cells.Add(td);
tb.Rows.Add(tr);
form1.Controls.Add(tb);
}
}
Regards,
Arul R
arul44.ece@gmail.com