We are using a Grid with a dynamic type. This has been working for us until we ran into the problem of a column editor template receiving null data. The editor template accepts non-nullable TimeSpans but when the grid initializes it is trying to send this editor template a null TimeSpan object. When I change the grid to one of the classes it should be getting such as DownTimeViewModel this error doesn't happen.
"Message: The model item passed into the dictionary is null, but this dictionary requires a non-null model item of type 'System.TimeSpan'."
@(Html.Kendo().Grid<dynamic>() .Name("SomeName") .Columns(columns => { foreach (Field field in cols) { if (string.IsNullOrWhiteSpace(field.EditorTemplateName)) { throw new NotImplementedException("EditorTemplate is not set and it needs to be"); } columns.Bound(field.Member) .Title(field.Title) .Visible(field.Visible) .Hidden(field.Hidden) .Filterable(field.Filterable) .IncludeInMenu(field.IncludeInMenu) .Encoded(field.Encoded) .Format(field.Format) .Width(field.Width) .Sortable(field.Sortable) .ClientTemplate(field.ClientTemplate) .EditorTemplateName(field.EditorTemplateName) .HeaderHtmlAttributes(field.HeaderHtmlAttributes) .EditorViewData(Util.CreateNewObject(field.AdditionalViewData)); } }) .Scrollable() .ToolBar(toolbar => { toolbar.Create(); toolbar.Custom().Text("Delete").Action("Grid_Delete", "Downtime", new { WONumber = Model.WONumber }); //toolbar.Save(); }) .Editable(editable => editable.Mode(GridEditMode.InCell)) .Sortable() .DataSource(dataSource => dataSource .Ajax() .Batch(true) .PageSize(5) .Model(model => { foreach (Field field in cols) { model.Id(field.Member); } foreach (Field field in cols) { model.Field(field.Member, field.MemberType).DefaultValue(field.DefaultValue).Editable(field.Editable); } } ) .Read(read => read.Action("Grid_Read", "Downtime", new { id = Model.WONumber.ToString() })) .Create(create => create.Action("Grid_Create", "Downtime")) .Update(update => update.Action("Grid_Update", "Downtime")) .Destroy(destroy => destroy.Action("Grid_Delete", "Downtime")) ))
