Reputation: 904
I am trying to bind my KendoUI grid and I am getting a 500 server error in the console. The only thing I can think of is that it doesn't like "@(Html.Kendo().Grid()" but intellisense does not error out. Does it seem like something is setup wrong with my project? Any advice would be greatly appreciate. Below is what I have in my controller and Index.cshtml page.
public ActionResult Customers_Read([DataSourceRequest]DataSourceRequest request) {
using (var ctx = new DataEntities()) {
IQueryable<Customer> customers = ctx.Customers;
DataSourceResult result = customers.ToDataSourceResult(request);
return Json(result);
}
@(Html.Kendo().Grid<DataLibrary.Customer>()
.Name("grid")
.Columns(columns => {
columns.Bound(c => c.Name);
columns.Bound(c => c.Phone);
columns.Bound(c => c.Fax);
columns.Bound(c => c.Website);
})
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Read(read => read.Action("Customers_Read", "Customers"))
)
)
Upvotes: 0
Views: 1020
Reputation: 973
Does your Customer_Read method work ok?
Is the result variable populated with the results of the search?
Try adding AllowGet property.
return Json(result, JsonRequestBehavior.AllowGet);
Upvotes: 1