I am using this code to get my data and push it to the Kendo Grid
public ActionResult Read([DataSourceRequest] DataSourceRequest request)
{
return Json(GetData(request), JsonRequestBehavior.AllowGet);
}
private DataSourceResult GetData(DataSourceRequest request)
{
var Items = _db.Item.Local.ToDataSourceResult(request, x => new
{
ID = x.ID,
Title = x.Title,
LastEdited = x.User.LoginName,
Category = x.CategoryItem.Title,
DateEdited = x.DateEdited
});
return Items;
}
Using no model in the view for the Grid, letting the Grid figure everything out. This all works and I can browse through pages too. However the moment I add in a sorting method it throws me this exception for example:
Invalid property or field - 'Category' for type: Item
And each subsequent request fails because it has the sort in the DataSourceRequest until I reload the page to clear the request. Am I missing something here in terms of configuration that I need to add to this code?