In my ASP.NET MVC application I am using a select list control to generate a list for a multiselect widget:
<%=Html.ListBoxFor( m => m.Product.Name,
new SelectList(
Model.Products.Where(
s => !Model.Product.Any(
t => t.Id == s.Id.Value
) ).OrderBy( t => t.Name ), "Id", "Name",
new { multiselect = "multiselect", @class = "fancySelect products"} ) ) %>
Which will generate a list of items. The problem is that some of them need encoding:
<span>Cōnetic™ Technology</span>
If I render this item directly to the UI using a simple response.write I see this:
<p class="c">Cōnetic™ Technology</p>
How would I go about integrating an Html.Encode into my select list statement to produce the same encoding result? Or is there a better encoding method that will effect select lists on a global level?
This is MVC 2 btw, so no razor.