Hello, I recently update the Kendo version of my project to 2016.1.226.545, and after that I can't show the data on the grids i have, the first time a page load the grid is empty, if I click any column, like sorting the grid, display a Json Object on the screen. Am I losing a js file to add or has anyone an idea what could be happening? Before the update the code was working perfectly.
Here is how i am doing the code,
View
@(Html.Kendo().Grid<Project.Models.Products>()
.Name("Products")
.Scrollable()
.Sortable()
.EnableCustomBinding(true)
.HtmlAttributes(new { style = "height:auto;" })
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(x => x.Code);
})
.ServerOperation(false)
.PageSize(20)
.Read(read => read.Action("LoadProducts", "Products"))
)
.Columns(columns =>
{
columns.Bound(p => p.Product).Title("Product").Width(70);
columns.Bound(p => p.Code).Title("Code").Width(70);
columns.Bound(p => p.Description).Title("Description").Format("{0:0,0.0}").Width(250);
}))
Controller
public ActionResult Products()
{
return View();
}
public ActionResult LoadProducts([DataSourceRequest]DataSourceRequest request)
{
clsData cns = new clsData();
IQueryable<consultProducts> s2 = cns.getProducts().ToList().AsQueryable();
DataSourceResult result = s2.ToDataSourceResult(request, p => new Products
{
Code= p.code,
Product= p.product,
Description= p.description,
});
return Json(result, JsonRequestBehavior.AllowGet);
}
And the result is a Json object like this
{"Data":[{"Code":0001,"Description":"Natural oil","Product":01}],"Total":1,"AggregateResults":null,"Errors":null}