Hello Everyone,
This is the first time I am posting to Kendo Forums, so forgive me if I step over any posting rules.
I am very new to Kendo UI and MVC 4. So far, I have been able to get the data to display on the grid on my web page.
But I am having issues with the data binding to the grid. The first time the page displays, it correctly displays the first 10 records, but when I click on "Go to Next page", the web page throws error.
I understand that it has to do with data binding to the grid. My question is, how do I go about this? i.e. Do I need to add the code to the controller or the view? and if so, where should I add the new method and how would it look like? I am posting my code below for your review. Please feel free to make any suggestions. Thank you for reading.
@model IEnumerable<MVC4Trial.Models.vwCallDetail>
@{
ViewBag.Title = "Index";
}
<h2>Call Detail View</h2>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.CCCID).Width(50).Title("CCCID");
columns.Bound(p => p.Mp3_Url).Width(50).Title("MP3 URL");
columns.Bound(p => p.Target_Number).Width(50).Title("Target Number");
columns.Bound(p => p.Duration).Width(50);
columns.Bound(p => p.Index).Width(50);
columns.Bound(p => p.LocalTime).Width(50);
columns.Bound(p => p.Site_Name___Address).Width(50).Title("Site Address");
columns.Bound(p => p.Ad_Source_Name).Width(50).Title("Ad Source Name");
columns.Bound(p => p.Tracking_Number).Width(50).Title("Tracking Number");
columns.Bound(p => p.Caller_Number).Width(50).Title("Caller");
columns.Bound(p => p.Available_Feature).Width(50).Title("Features");
})
.Groupable()
.Pageable(page => page.Enabled(true).PageSizes(new Int32[] {10, 20, 30, 40}))
.Sortable(sorting => sorting.SortMode(Kendo.Mvc.UI.GridSortMode.SingleColumn))
.Scrollable()
.Filterable()
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("vwCallDetail", "Grid"))
.PageSize(10)
.ServerOperation(true)
.PageSize(10)
)
.Resizable(resize =>resize.Columns(true))
.Reorderable(reordering => reordering.Columns(true))
)
This is the first time I am posting to Kendo Forums, so forgive me if I step over any posting rules.
I am very new to Kendo UI and MVC 4. So far, I have been able to get the data to display on the grid on my web page.
But I am having issues with the data binding to the grid. The first time the page displays, it correctly displays the first 10 records, but when I click on "Go to Next page", the web page throws error.
I understand that it has to do with data binding to the grid. My question is, how do I go about this? i.e. Do I need to add the code to the controller or the view? and if so, where should I add the new method and how would it look like? I am posting my code below for your review. Please feel free to make any suggestions. Thank you for reading.
@model IEnumerable<MVC4Trial.Models.vwCallDetail>
@{
ViewBag.Title = "Index";
}
<h2>Call Detail View</h2>
@(Html.Kendo().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.CCCID).Width(50).Title("CCCID");
columns.Bound(p => p.Mp3_Url).Width(50).Title("MP3 URL");
columns.Bound(p => p.Target_Number).Width(50).Title("Target Number");
columns.Bound(p => p.Duration).Width(50);
columns.Bound(p => p.Index).Width(50);
columns.Bound(p => p.LocalTime).Width(50);
columns.Bound(p => p.Site_Name___Address).Width(50).Title("Site Address");
columns.Bound(p => p.Ad_Source_Name).Width(50).Title("Ad Source Name");
columns.Bound(p => p.Tracking_Number).Width(50).Title("Tracking Number");
columns.Bound(p => p.Caller_Number).Width(50).Title("Caller");
columns.Bound(p => p.Available_Feature).Width(50).Title("Features");
})
.Groupable()
.Pageable(page => page.Enabled(true).PageSizes(new Int32[] {10, 20, 30, 40}))
.Sortable(sorting => sorting.SortMode(Kendo.Mvc.UI.GridSortMode.SingleColumn))
.Scrollable()
.Filterable()
.DataSource(datasource => datasource
.Ajax()
.Read(read => read.Action("vwCallDetail", "Grid"))
.PageSize(10)
.ServerOperation(true)
.PageSize(10)
)
.Resizable(resize =>resize.Columns(true))
.Reorderable(reordering => reordering.Columns(true))
)