I have an ASP.NET MVC app. My app is displaying values from the model in my view like this:
public static MvcHtmlString ToMeasure<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression, string measurement = "sf")
{
if (measurement == "m2")
measurement = "m<sup>2</sup>";
return System.Web.Mvc.Html.ValueExtensions.ValueFor(html, expression, "{0:N0} " + measurement);
}
Sometimes, measurement will represent square feet. Other times, it will represent square meters. When its square meters, I want to user the HTML sup tag. Unfortunately, right now, it renders as a literal m<sup>2</sup> instead of as an actual superscript. How do I tell MVC to use a superscript instead of the literal?
Thanks!