Hi,
I want to display an enum in my dropdown list column of Kendo Grid.
I get an success till binding the enum in a dropdown list and displaying it to the Grid. But however it displays as a textbox instead of a dropdown list when I add/edit an item in edit popup. It shows proper dropdown list in InLine editing mode.
One more issue is it displays enum values (1, 2 or 3) instead of enum texts (Red, Amber or Green) in a grid.
Please help.
Thanks,
Nirav
I want to display an enum in my dropdown list column of Kendo Grid.
I get an success till binding the enum in a dropdown list and displaying it to the Grid. But however it displays as a textbox instead of a dropdown list when I add/edit an item in edit popup. It shows proper dropdown list in InLine editing mode.
One more issue is it displays enum values (1, 2 or 3) instead of enum texts (Red, Amber or Green) in a grid.
My grid column is:columns.Bound(r => r.RagStatus).EditorTemplateName("RAGStatus");Enum is:public enum RAGStatus{ Red = 1, Amber = 2, Green = 3,}public static List<SelectListItem> EnumToSelectList(Type enumType){ return Enum .GetValues(enumType) .Cast<int>() .Select(i => new SelectListItem { Value = i.ToString(), Text = Enum.GetName(enumType, i), } ) .ToList();}Enum template is:@model int@( Html.Kendo().DropDownListFor(m => m) .BindTo(EnumToSelectList(typeof(RAGStatus)).ToList()) .OptionLabel(optionLabel: "Please Select") .SelectedIndex(0))Thanks,
Nirav