Dear guys ,
How to create dropdown list control dynamically in asp.net
give me sample code.
Create DropDownList Dynamically
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
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 attend4days leftRegister
Pankaj RanaRank #2,270 · 620 reputationPosted Mar 21, 2012, 4:13 AM EDT
Satyapriya NayakRank #47 · 31.5K reputationPosted Mar 21, 2012, 7:36 AM EDT
Panel pnlDropDownList;
protected void Page_PreInit(object sender, EventArgs e)
{
//Create a Dynamic Panel
pnlDropDownList = new Panel();
pnlDropDownList.ID = "pnlDropDownList";
pnlDropDownList.BorderWidth = 1;
pnlDropDownList.Width = 300;
this.form1.Controls.Add(pnlDropDownList);
//Create a LinkDynamic Button to Add TextBoxes
LinkButton btnAddDdl = new LinkButton();
btnAddDdl.ID = "btnAddDdl";
btnAddDdl.Text = "Add DropDownList";
btnAddDdl.Click += new System.EventHandler(btnAdd_Click);
this.form1.Controls.Add(btnAddDdl);
//Recreate Controls
RecreateControls("ddlDynamic", "DropDownList");
}Please refer the below link
http://www.aspsnippets.com/Articles/Creating-Dynamic-DropDownList-Controls-in-ASP.Net.aspx
Thanks