Cannot display enum values on kendo MVC grid?

2 posts, 0 answers
  1. wawar
    wawar avatar
    2 posts
    Member since:
    Nov 2016

    Posted 06 Dec 2016 Link to this post

    Enum class

    public class Voltage
      {
          public int Id{ get; set; }
          public string RefNo { get; set; }
          public VoltageLevel VoltageLevel { get; set; }
      
      }
      public enum VoltageLevel
      {
          LV = 1,
          MV = 2,
          HV = 3   }

     

    Controller

    public ActionResult Voltage_Read([DataSourceRequest]DataSourceRequest request)
         {
             IQueryable<Voltage> voltage= db.Voltage;
             DataSourceResult result = voltage.ToDataSourceResult(request, voltage=> new {
                 Id = voltage.Id,
                 RefNo = voltage.RefNo,
                 VoltageLevel = voltage.VoltageLevel,
             });
             return Json(result);
         }

     

    View

    @(Html.Kendo().Grid<entities.voltage>()
    .Name("grid")
    .Columns(columns =>
    {
    columns.Bound(c => c.RefNo);
    columns.Bound(c => c.VoltageLevel); //here the voltagelevel didnt show.
    })
  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    4529 posts

    Posted 08 Dec 2016 Link to this post

    Hi,

    Since your question is related to the MVC grid, I have answered its clone in the proper forum: http://www.telerik.com/forums/cannot-display-enum-values-on-kendo-mvc-grid-A3A007EF0B0B. In the future I would advise that you post your questions in the most appropriate forum so they will have the proper audience.

    Regards,

    Marin Bratanov
    Telerik by Progress
    Kendo UI is ready for Visual Studio 2017 RC! Learn more.
Back to Top