protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if (TextBox1.Text != string.Empty)
{
int count = 0;
int.TryParse(TextBox1.Text, out count);
for (int i = 0; i < count; i++)
{
TextBox txt = new TextBox();
txt.ID = "dynamicText" + i.ToString();
if (PlaceHolder1.FindControl(txt.ID) != null)
{
PlaceHolder1.Controls.Add(txt);
}
}
}
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != string.Empty)
{
int count=0;
int.TryParse(TextBox1.Text,out count);
for (int i = 0; i < count; i++)
{
TextBox txt = new TextBox();
txt.ID = "dynamicText" + i.ToString();
PlaceHolder1.Controls.Add(txt);
}
}
}