I have some problems getting the data to display on my Kendo.Grid.
JSON is valid and it displays when the link is clicked as text, but it loads the data into the grid.
Here is the source, any help would be appreciated!
br Eero
controller
public ActionResult Index([DataSourceRequest]DataSourceRequest request) { using (var db = new CimDataContext()) { IQueryable<Customer> customers = db.Customers; DataSourceResult result = customers.ToDataSourceResult(request); return Json(result, "text/x-json", JsonRequestBehavior.AllowGet); } }
Index.cshtml
@(Html.Kendo().Grid<KendoUIMvcCim.Models.Customer>() .Name("grid") .DataSource(dataSource => dataSource .Ajax() .Read(read => read.Action("Index", "Customer")) ) .Columns(columns => { columns.Bound(customer => customer.Id); columns.Bound(customer => customer.Name); columns.Bound(customer => customer.Number); columns.Bound(customer => customer.AgentID); columns.Bound(customer => customer.Info); columns.Bound(customer => customer.Email); columns.Bound(customer => customer.StartTime); columns.Bound(customer => customer.EndTime); columns.Bound(customer => customer.Category); }) .Pageable() .Sortable()
)
Result in browser
{"Data":[{"Id":2,"Name":"Name1","Number":"040000000","AgentID":"1","Info":"info1","Email":"email1","StartTime":"\/Date(1360101600000)\/","EndTime":null,"Category":"Laser"},{"Id":3,"Name":"Name2","Number":"0400000000","AgentID":"2","Info":"info2","Email":"email2","StartTime":"\/Date(1360188000000)\/","EndTime":null,"Category":"Kaihi"}],"Total":2,"AggregateResults":null,"Errors":null}