Generate web server control dynamically

Foobar

New Member
I am wanting to generate web server controls dynamically, say generating and showing several <asp:dropdownlist>. <BR>The result should be there may have 2 dropdownlist or may have 12 dropdownlist shown on the web page <BR>according to a database table.<BR><BR>Please help, much appreciated. <BR>If the dropdowns are all the same then you could use a datagrid with the dropdownlist in the itemtemplate. If they are all different then just change there visibility if you need them.If you are talking about dynamically adding controls to a page, then you should look into the Add method for the Controls collection.<BR><BR>Maybe something like this:<BR><BR>[C#]<BR>Page.Controls.Add(yourControl);<BR><BR>Check out this URL, it may get you started.<BR>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicontrolcollectionclassaddtopic.asp<BR><BR>
 
Back
Top