Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning a web control from a function?
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Returning a web control from a function?
Divers
Thread ID:
00713893
Message ID:
00713893
Vues:
43
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform