I have a model with an enum as a data type on a property. In the grid I want to show an image representation for this enum. Whats the best way to do this?
I've tried using the ClientTemplate to do this. I'm not sure what I need. I have tried the following without success:
@(Html.Kendo().Grid<BatchEditModel>()
.Name(
"mygrid"
)
.Columns(columns =>
{
columns.Bound(bem => bem.MyInfo.Number).ClientTemplate(
"# if (MyStatus == "
+ MyStatusConstants.Complete + ") { #
<span
class
=
"icon-oo-my-img-32"
style=
"font-size: 1.2em; color: green"
></span>
"# } #"
"# else if (MyStatus == "
+ MyStatusConstants.PWHTRequired +
") { #"
<span
class
=
"icon-oo-my-img-32"
style=
"font-size: 1.2em; color: darkcyan"
></span>
"# } #"
"# else if (MyStatus == "
+ MyStatusConstants.Myed +
") { #"
<span
class
=
"icon-oo-my-img-32"
style=
"font-size: 1.2em; color: blue"
></span>
"# } #"
)
This has errors in the razor page. I had the all the text wrapped in quotes and used + to concatenate them.
The question is, I have an enum as a value, but I want to display an image - which is a custom glyph icon on the span. What is the best way to implement this?
Thanks
Andez