default.aspx
<!--
<div>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"
style="height: 26px" />
</div>
--!>
<!--
<div>
<asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click"
style="height: 26px" />
</div>
--!>
default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
TextBox new_textbox = new TextBox();
new_textbox.ID = "txt" + 1;
new_textbox.Text = "";
PlaceHolder1.Controls.Add(new_textbox);
}
protected void Button1_Click(object sender, EventArgs e)
{
string OptionID = "txt" + 1;
TextBox tb = (TextBox)PlaceHolder1.FindControl(OptionID);
Response.Write(tb.Text);
}
{
TextBox new_textbox = new TextBox();
new_textbox.ID = "txt" + 1;
new_textbox.Text = "";
PlaceHolder1.Controls.Add(new_textbox);
}
protected void Button1_Click(object sender, EventArgs e)
{
string OptionID = "txt" + 1;
TextBox tb = (TextBox)PlaceHolder1.FindControl(OptionID);
Response.Write(tb.Text);
}
No comments:
Post a Comment