Thursday, August 13, 2009

How To Create Dynamic TextBox With Event Handler

    protected void Page_Load(object sender, EventArgs e)
    {
        createTxt();
    }

    private void createTxt()
    {
       
        TextBox txt = new TextBox();
        txt.ID = "txt1";
        txt.AutoPostBack = true;
        txt.TextChanged += new EventHandler(txt_TextChanged);
        form1.Controls.Add(txt);       
    }

    void txt_TextChanged(object sender, EventArgs e)
    {
        TextBox txtBx = (TextBox)sender;
        Page.Title = txtBx.Text;
    }




No comments:

Creative Commons License
Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.