Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
every ADD button click event Create 2 textbox at a time in a coulum
Posted

1 solution

C#
TextBox tb;
static int i = 0;
protected void Button_Click(object sender, EventArgs e)
{
        i++;
    for(j=0;j<=i;j++)
    {
    tb = new TextBox();
    tb.ID = j.ToString();

    PlaceHolder1.Controls.Add(tb);
    }

}


that means you need to create the added textbox again...because you are adding control dynamically to the page...
 
Share this answer
 
Comments
Member 10385151 5-Aug-14 5:50am    
how to add again next 2 textbox ???
Siva Hyderabad 5-Aug-14 5:54am    
if you click on button, then it will added automatically

Siva Hyderabad 5-Aug-14 6:01am    
hello member10385151? is it working or not?
Member 10385151 5-Aug-14 6:56am    
it is working in single time .when it click next time it not working autometically
Siva Hyderabad 5-Aug-14 7:05am    
if you click on button first time, then it will add two textboxes ,after clicking then it will adding one textbox..

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