Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add DropDownList in a Panel or PlaceHolder programmarically

Status
Not open for further replies.

chuair

Programmer
Apr 9, 2001
20
SG
Hi,

How do I programmatically add a DropDownList into a Panel or PlaceHolder?

I used:-

DropDownList ddlSite = new DropDownList();
panelSite.Controls.Add(ddlSite);

The problem with this is that two DropDownList will appear in the Panel/PlaceHolder. And then I tried adding Attributes of onselectedindexchanged but seems like it doesn't work

ddlSite.Attributes["id"] = "ddlSite";
ddlSite.Attributes["runat"] = "server";
ddlSite.Attributes["onselectedindexchanged"] = "siteChange";

Thanks




Chuair
 
This is a forum for Active Server Pages (ASP). The code you posted appears to either VB or perhaps some kind of ASP.Net that I'm not familiar with. Either way this isn't the correct forum, so you're not likely to get your answer here.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top