How to add 10 textboxes on one click
Can any one know how to add 10 textboxes on one click in asp.net
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Feb 4, 2015, 4:56 AM EST
// ....
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 3, 2015, 6:15 PM EST
int n=5; for (int i=0;i
{
TextBox MyTextBox=new TextBox(); //Assigning the textbox ID name
MyTextBox.ID = "tb" +""+ ViewState["num"] + i;
this.Controls.Add(MyTextBox);
}
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 3, 2015, 6:17 PM EST
For anyone else trying to do something like this, don't. Instead, think of the flow of information and understand that there is a better way to do it. The input control(s) do not need to be dynamically created. They can be static, and upon filling out and submitting on one, that information has to go somewhere (database, cache, session, for example). Once it's there, on postback, loop through all items in your storage of choice and creates a display for them.
Khargesh RajputRank #616 · 3.9K reputationPosted Feb 3, 2015, 6:24 PM EST
akshay rasalakar106 reputationPosted Feb 3, 2015, 6:59 PM EST
akshay rasalakar106 reputationPosted Feb 3, 2015, 6:59 PM EST
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Feb 3, 2015, 7:03 PM EST
akshay rasalakar106 reputationPosted Feb 4, 2015, 4:28 AM EST
arun kumar123 reputationPosted Mar 26, 2015, 3:53 AM EDT