Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I have a dropdownlist ddlProduct Name and quantity text box. When I Select a Product Name and write the quantity in my textboxes and click the Button1 that number of textboxes are generating in my place holder according to quantity value. but when I am again go to choose the another product and quantity and click the Button 1 then the current quantity textboxes are generating and not showing the previous selected textboxes. I need to generate the textboes of present product and previous. Both should appear in my place holder.How will i Do it. Kindly Help.



C#
protected void Button1_Click(object sender, EventArgs e)
    {

        {
            if (txtQuantity.Text != "")
            {
                for (int i = 0; i < Convert.ToInt16(txtQuantity.Text); i++)
                {
                  
                    
                        Label la = new Label();
                        la.Text = ddlProductName.SelectedItem.Value + i.ToString();
                        la.ID = "abc" + i.ToString();

                        PlaceHolder1.Controls.Add(la);

                        //la = FindControl(String.Format(i)) as Label;




                        TextBox txtbox = new TextBox();
                        txtbox.Text = "Textbox - " + i.ToString();


                        PlaceHolder1.Controls.Add(new LiteralControl("<input id='txt' name='Textbox" + i + "'type='text'  />"));
                        PlaceHolder1.Controls.Add(new LiteralControl("<br />"));

                    }
                }
            }
        
    }
Posted
Updated 2-Apr-14 0:28am
v2

1 solution

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