I'm just evaluating the Kendo grid for an upcoming project and I'm hunting for demos for the functionality that I need.
I have created a grid in an asp.net razor view that takes a viewmodel. A couple of the model properties are enums which display nicely but when clicking into the cell just render a text box with the enum value (1,2,3,etc).
Does anyone have a demo where the edit field is an appropriate dropdown rather than the raw value of the enum?
Thanks in advance :)
=================================================================================
For reference the model and view I'm using are:
I have created a grid in an asp.net razor view that takes a viewmodel. A couple of the model properties are enums which display nicely but when clicking into the cell just render a text box with the enum value (1,2,3,etc).
Does anyone have a demo where the edit field is an appropriate dropdown rather than the raw value of the enum?
Thanks in advance :)
=================================================================================
For reference the model and view I'm using are:
public class HomeMonitorViewModel { public int Id { get; set; } [Required, StringLength(255)] public string Name { get; set; } [Required, StringLength(128)] public string HostSystem { get; set; } public string Description { get; set; } public Data.MonitorClassification Classification { get; set; } public DateTime DateAdded { get; set; } public bool HasBeenAdministered { get; set; } public Data.MonitorSource Source { get; set; } public int MonitorAliasId { get; set; } public string MonitorAliasName { get; set; }}public enum MonitorClassification { Default = 1, Standard = 2, Bespoke = 3}public enum MonitorSource { Policy = 1, Adhoc = 2, Unknown = 3}@(Html.Kendo().Grid<ProjectBlackSun.Models.Home.HomeMonitorViewModel>() .Name("MonitorGrid") .Columns(c => { c.Bound(m => m.Name); c.Bound(m=>m.MonitorAliasName); c.Bound(m=>m.Description); c.Bound(m=>m.HostSystem); c.Bound(m=>m.Classification); c.Bound(m=>m.Source); }) .ToolBar(t => { t.Create(); t.Save(); }) .Editable(e => e.Mode(GridEditMode.InCell)) .Pageable() .Sortable() .DataSource(d => d .Ajax() .Batch(true) .ServerOperation(false) .Events(e => e.Error("error_handler")) .Model(model => model.Id(monitor => monitor.Id)) .Create("MonitorGridCreate", "Home") .Read("MonitorGridRead", "Home") .Update("MonitorGridUpdate", "Home") .Destroy("MonitorGridDestroy", "Home") ))<script type="text/javascript"> function error_handler(e) { if (e.errors) { var message = "Errors:\n"; $.each(e.errors, function (key, value) { if ('errors' in value) { $.each(value.errors, function() { message += this + "\n"; }); } }); alert(message); } }</script>