开发者

Data in dynamic textbox

I creat开发者_JS百科ed textboxed dynamically, But when I clicked on the button, I loss before created data in the textbox. How can I maintain data in the dynamic textbox.


Try this:

protected void Page_Load(object sender, EventArgs e)
{
    TextBox text = new TextBox()
    {
        ID = "TextBox1"
    };

    Button button = new Button()
    {
        Text = "Submit"
    };

    button.Click += (s, a) =>
        {
            text.Text = Request["TextBox1"];
        };

    PlaceHolder1.Controls.Add(text);
    PlaceHolder1.Controls.Add(button);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜