Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a place holder in a webpage and one TextBox and one DropDownlist. Textbox is for entering quantity of products and DropDownList is for product names. when i am selecting a product name(suppose RAM)from the DropDownList and suppose i write int the text box 3 as the quantitity of products. There is a OK button also when i m clicking the ok button 3 text boxes with levels are generated in the placeholder as given below:-
RAM textbox
RAM textbox
RAM textbox

But My requirement is it should display as

RAM1 textbox
RAM2 textbox
RAM3 textbox

Again whatever we write in this textboxes are the serial numbers and that are must be updated in a database. Kindly help to solve this problem.
Posted
Comments
Dinesh.V.Kumar 10-Feb-14 1:00am    
Can you paste the code where you are generating the "RAM textbox" part? This may help us solve your problem...

Regards
Member 10578683 10-Feb-14 6:34am    
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;
la.ID = "abc" + i.ToString();

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


TextBox tb1 = new TextBox();
tb1.ID = "ghj" + i.ToString();
PlaceHolder1.Controls.Add(tb1);
PlaceHolder1.Controls.Add(new LiteralControl("<br/>"));

}
}
}
}
Member 10578683 10-Feb-14 6:35am    
RAM1 RAM2 are Labels not text boxes.
Dinesh.V.Kumar 10-Feb-14 6:37am    
Try this
la.Text = ddlProductName.SelectedItem.Value + i.ToString();

Regards,
Member 10578683 10-Feb-14 6:50am    
Thanks My friend it is working

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