In ASP.NET MVC 3 application I am developing I have an enumeration and custom display template for it.
In one of the views I need to display specific enum value, but when I write code like:
@Html.DisplayFor(model => EnumType.EnumValue)
I recieve compilation error:
Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.
I can think of solution to add property to my model with appropriate value, but maybe there is easier approach to leverage my display template in such scenario?