Hi,
I have an drop downlist whic contains the products and a textbox for quantity. when i am selecting the dropdownlist and write the quantity value in the textboxes and click the Button1 textboxes are dynamically generating in the placeholder with labels according to quantity but when again i am selecting the other product from the dropdownlist then clickin the button then new textboxes are generating and previous textboes disappears. I needs the previou textboes also. how will i do. Please help.
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;
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/>"));
}
}
}