It is not clear from your question what the basic type of the Status property is. If it is CheckStatus , then @Html.DisplayFor(modelItem => item.Status) display exactly what you expect. If, on the other hand, it is an integer, you can write a custom helper to display the correct value:
public static class HtmlExtensions { public static IHtmlString DisplayEnumFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, int>> ex, Type enumType) { var value = (int)ModelMetadata.FromLambdaExpression(ex, html.ViewData).Model; string enumValue = Enum.GetName(enumType, value); return new HtmlString(html.Encode(enumValue)); } }
and then use it like this:
@Html.DisplayEnumFor(modelItem => item.Status, typeof(CheckStatus))
and suppose you want to bring this helper further and take into account the DisplayName attribute for your enum type:
public enum CheckStatus { [Display(Name = "oh yeah")] Yes = 1, [Display(Name = "no, no, no...")] No = 2, [Display(Name = "well, dunno")] Maybe = 3 }
Here you can expand our user assistant:
public static class HtmlExtensions { public static IHtmlString DisplayEnumFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, int>> ex, Type enumType) { var value = (int)ModelMetadata.FromLambdaExpression(ex, html.ViewData).Model; string enumValue = Enum.GetName(enumType, value); var field = enumType.GetField(enumValue); if (field != null) { var displayAttribute = field .GetCustomAttributes(typeof(DisplayAttribute), false) .Cast<DisplayAttribute>() .FirstOrDefault(); if (displayAttribute != null) { return new HtmlString(html.Encode(displayAttribute.Name)); } } return new HtmlString(html.Encode(enumValue)); } }