![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgmjQ1dBb2hD2LU0WEk4P6JgBXSk71f4-LPj08lbW27CfmJoZIslVsa6HrGEc2QJu2AGPWa9oPiGSIFTek-Ow0hLwynNTd4IXxJp7X43fC1CGHtNG2Op83dtEm-L4gWgppBemnDOF-6e4BG/s400/r.bmp)
Firstly add a panel control ,a textbox and a button to design page .when we enter a number in textbox at run time ,the same number controls are created at runtime.
Source Code:
protected void btninsert_Click(object sender, EventArgs e)
{
int count =Convert.ToInt32(TextBox1.Text);
Panel1.Controls.Clear();
Table tb = new Table();
tb.GridLines = GridLines.Both;
for (int i = 0; i < count; i++)
{
TableCell c1 = new TableCell();
TableRow rw = new TableRow();
TextBox tx = new TextBox();
c1.Controls.Add(tx);
rw.Cells.Add(c1);
tb.Rows.Add(rw);
}
Panel1.Controls.Add(tb);
}
No comments:
Post a Comment