This is a migrated thread and some comments may be shown as answers.

Cannot display enum values on kendo MVC grid?

1 Answer 753 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wawar
Top achievements
Rank 1
wawar asked on 06 Dec 2016, 08:57 AM

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.
})

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 08 Dec 2016, 08:18 AM

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.
Tags
Grid
Asked by
wawar
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or