Dear guys ,
How to create dropdown list control dynamically in asp.net
give me sample code.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Mar 21, 2012, 11:36 AM
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
Pankaj RanaPosted Mar 21, 2012, 8:13 AM