I have a dropdownlist in my webform that contains several items (language select). I want to add a countryflag before the listitem text but asp.net doesn't render html in a dropdownlist. What is the best way to do so? The listitem value must be retained. The country flag is just an image...
I'm using a jquery attempt now but it doens't work.
ASP:
<asp:DropDownList
id="ddlLanguage"
runat="server"
DataTextField="Value"
DataValueField="Text"
AutoPostBack="true">
</asp:DropDownList>
Code-behind:
ListItem langListEN = new ListItem("EN");
langListEN.Attributes.Add("id", "idEN");
ddlLanguage.Items.Add(langListEN);
jQuery
var flagEN = $('#ddlLanguage option#idEN');
flagEN.prepend( "<img src='../assets/images/country/gb.png' />" );