I am using the Kendo grid in my ASP.Net MVC application. If I have the following grid definition,
@(Html.Kendo().Grid(Model) //Bind the grid to ViewBag.Products
  .Name("grid")
  .Columns(columns =>
  {
      columns.Bound(p => p.FullName);
      columns.Bound(p => p.MyEnum)
  })
  .Groupable()
  .Pageable()
  .Sortable()
  .Scrollable(scr => scr.Height(600))
  .Filterable()
  )
where one of the column is an Enum. My enum definition is:
public enum MyEnum
{
    [Display(AutoGenerateField = false, Name = "My enum 1", Description = "My Enum 1")]
    EnumOne,
    [Display(Name = "My Enum 2")]
    EnumTwo
}
How do I make it display "My Enum 1" or "My Enum 2" for each row?
Thanks in advance!
I recently ran into this problem and solved it by using
var someArrayOfValueAndText = new[] {new  {
    Id = 0, Description = "Foo"
}, new  {
    Id = 1, Description = "Bar"
}
.Columns(c.ForeignKey(m=> m.MyEnum, someArrayOfValueAndText, "Id","Description"))
instead of the .Bound method
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With