Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Returning a web control from a function?
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Returning a web control from a function?
Miscellaneous
Thread ID:
00713893
Message ID:
00713893
Views:
42
All,

I solved the problem I was having with dynamically setting the background for elements in a drop down list by using the LiteralControl command:
Controls.Add(new LiteralControl("<select name=\"ddl\" id=\"ddl\">"));
for(int i=0; i < DS.Tables[0].Rows.Count; i++)
{
     Controls.Add(new LiteralControl("<option value=\"" + DS.Tables[0].Rows[i]["OV"] + "\" style=\"background-color: " + DS.Tables[0].Rows[i]["CV"] + "\">" + DS.Tables[0].Rows[i]["Color"] + "</option>"));
}
Controls.Add(new LiteralControl("</select>");
My question is - if I am implmenting this as a function, what do I return this as to the calling program - System.Web.WebControls.DropDownList?

Or can I not return it - the control is written out as it is implemented?

TIA,
Doug
Douglas Osborne
Don't spend your life just wishing - http://www.AllGiftRegistry.com
Next
Reply
Map
View

Click here to load this message in the networking platform