I also have no luck with this issue. I can see using the developer tools in Chrome that my Json data is returned in full with 200 status code but the grid never rebinds to show the data. The only way I can get my grids to bind is to bind to the View model on the initial View page load which makes partial view and other loading types worthless.
This must be a bug. Referencing a grid as the following doesnt work:
@(Html.Kendo().Grid<
Codes
>()
.Name("CodesGrid")
.Columns(columns =>
{
//columns.Command(command => { command.Edit(); }).Width(60);
columns.Bound(o => o.CodeId);
columns.Bound(o => o.FieldName);
columns.Bound(o => o.FieldDescription);
columns.Bound(o => o.FieldType);
columns.Bound(o => o.FieldValueType);
columns.Bound(o => o.IsRequired).ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= IsRequired ?
checked
=
'checked'
:
checked
=
''
# />");
columns.Bound(o => o.IsActive).ClientTemplate("<
input
type
=
'checkbox'
disabled
=
'disabled'
#= IsActive ?
checked
=
'checked'
:
checked
=
''
# />");
columns.Bound(o => o.CreatedBy);
columns.Bound(o => o.CreatedOn).Width(180).Format("{0:MM/dd/yyyy hh:mm tt}");
})
//.ToolBar(toolbar => toolbar.Create())
.Pageable()
.Sortable()
.Filterable()
//.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.PageSize(50)
.Events(events => events.Error("error_handler"))
.Model(model =>
{
model.Id(o => o.CodeId);
model.Field(o => o.IsActive).DefaultValue(true);
model.Field(o => o.IsRequired).DefaultValue(false);
model.Field(o => o.CreatedBy).Editable(false);
model.Field(o => o.CreatedOn).Editable(false);
})
.Read(r => r.Action("GetCodes", "SysAdmin")))
)
Binding returns Json data using method :
public
ActionResult GetCodes([DataSourceRequest] DataSourceRequest request)
{
return
Json(_sysAdminService.GetCodes().ToDataSourceResult(request));
}
But this works:
@(Html.Kendo().Grid(Model) ...
public
IActionResult Codes()
{
var model = _sysAdminService.GetCodes();;
return
View(model);
}