如何在按钮单击事件中一次动态添加2个文本框
问题描述:
每个ADD按钮点击事件在coulum中一次创建2个文本框
every ADD button click event Create 2 textbox at a time in a coulum
答
TextBox tb;
static int i = 0;
protected void Button_Click(object sender, EventArgs e)
{
i++;
for(j=0;j<=i;j++)
{
tb = new TextBox();
tb.ID = j.ToString();
PlaceHolder1.Controls.Add(tb);
}
}
这意味着您需要再次创建添加的文本框...因为您正在动态地向页面添加控件...
that means you need to create the added textbox again...because you are adding control dynamically to the page...