Hi,
I am having an issue binding a KendoUI Grid to a JSON data source using MVC 4. I have the following setup:
3. The Index.aspx contains the KendoUI Grid as follows:
The debugger hits my breakpoint set inside the Reports_Read action when I launch the page, however nothing is bound to the grid. What am I missing here? I have tried setting AutoBind to true but this does not work.
I am having an issue binding a KendoUI Grid to a JSON data source using MVC 4. I have the following setup:
- One controller called DashboardController.cs
- The DashboardController.cs contains an action called Reports_Read which has the following code
public
ActionResult Reports_Read()
{
List<Report> reports =
new
List<Report>();
reports.Add(
new
Report
{
ReportId = Guid.NewGuid(),
Title =
"Lorem Ipsum"
,
BillToClient =
"Frosty Stevens"
,
MainRecipientContact =
"Dusty McLaren"
,
NextReportDue = DateTime.Now.AddDays(7),
PrimaryConsultant =
"Sprinkles O'Reilly"
,
ServiceCategoryCode =
"ABC"
});
reports.Add(
new
Report
{
ReportId = Guid.NewGuid(),
Title =
"Lorem Ipsum"
,
BillToClient =
"Harry Houdini"
,
MainRecipientContact =
"David Blaine"
,
NextReportDue = DateTime.Now.AddDays(7),
PrimaryConsultant =
"Dynamo"
,
ServiceCategoryCode =
"EFG"
});
return
Json(reports, JsonRequestBehavior.AllowGet);
}
<%:Html.Kendo().Grid<
ProcareGroup.Crm.Web.Models.Report
>()
.Name("grid")
.DataSource(ds => ds
.Ajax()
.ServerOperation(false)
.Read(r => {
r.Action("Reports_Read", "Dashboard");
}))
.Columns(c => {
c.Bound(r => r.Title);
c.Bound(r => r.PrimaryConsultant);
c.Bound(r => r.ServiceCategoryCode);
c.Bound(r => r.BillToClient);
c.Bound(r => r.NextReportDue);
})
.Pageable()
.Sortable()
%>