Click here to Skip to main content
15,908,674 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
tb1.ID = "txt" + k;
                        tb1.TextChanged += new EventHandler(tb1_TextChanged);




 protected void tb1_TextChanged(object sender, EventArgs e)
        {
            string tbvalue1 = string.Empty;
            string tbvalue2 = string.Empty;


        }
Posted

Hi,
Set the AutoPostBack property of textbox to true.
Use this:
C#
protected void tb1_TextChanged(object sender, EventArgs e)
{
    TextBox tb1 = new TextBox(); 
    tb1.ID = "txt0";
    tb1.AutoPostBack = true;
    tb1.TextChanged += new EventHandler(tb1_TextChanged);
    t1.Visible = false;
}
//Make your textbox visible true in some event.
//you need to find your control first
protected someEvents(object sender, EventArgs e)
{
    TextBox t1=(TextBox)Page.FindControl("txt0")
    t1.Visible = true;
}

protected void tb1_TextChanged(object sender, EventArgs e)
{
    string tbvalue1 = string.Empty;
    string tbvalue2 = string.Empty;
}



--Amit
 
Share this answer
 
v2
Comments
2011999 7-Aug-12 8:57am    
tb1.AutoPostBack = true; i set true but not fired
_Amy 7-Aug-12 9:00am    
Add your TextBox in Page_Init event so that the viewstate will be stored. And make it visible false. Wherever required make it true and use it..
TextBox tb1 = new TextBox();
tb1.ID = "txt0";
tb1.AutoPostBack = true;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900