Allow HTML in Html.ListBoxFor

412 Views Asked by At

How can I use HTML within a @Html.ListBoxFor(i => i.Ids, i.Items) to format each list item separately?

The text property of the SelectListItem has usually just text. But now I have to prepend an Icon with new SelectListItem { Text = "<i class \"fa fa-fw fa-lg fa-user\"></i> Some Text" }.

But ASP.NET MVC escapes me the string always. Is there already an implementation of a helper method with allows raw strings?

0

There are 0 best solutions below