【发布时间】:2012-11-09 09:27:18
【问题描述】:
我正在使用此代码
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="addnewtext" runat="server" Text="Add" onclick="addnewtext_Click" width="76px" />
和aspx.cs页面代码:
TextBox tb;
static int i = 0;
protected void addnewtext_Click(object sender, EventArgs e)
{
tb = new TextBox();
tb.ID = i.ToString();
PlaceHolder1.Controls.Add(tb);
i++;
}
每次单击按钮时,我都想添加另一个文本框。
【问题讨论】:
标签: c# asp.net dynamic controls