I want to populate a dropdown list with trademark and copyright characters but looks like they are always html encoded so what I get instead is their encoded form.
Thanks for your help.
When populating your SelectList, use HttpUtility.HtmlDecode on the text. Here's an example:
<%
var entities = new string[] { "©", "<">", "©" };
var selectListItems = entities.Select(e => new SelectListItem {
Text = HttpUtility.HtmlDecode(e), Value = "1"
});
%>
<%= Html.DropDownList("exampleDropDownList", selectListItems) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With