I have built an MVC Kendo Helper Grid that needs to display something other than the first page from the DataSource. I set the AutoBind to false, and ServerOperation to true.
I then have some javascript code which calls the page() function with the number 2, however during this call the controller still receives a 1. What am I doing wrong, or is there another way to set the initial page? Here is the code:
@(Html.Kendo().Grid<SF_SatAppsMVC4.Models.MD_GetUpcomingMTCEventsResult>().Name("gridUpcomingMTC")
.HtmlAttributes(new { @class = "clickableGrid" })
.AutoBind(false)
.DataSource(datasource => datasource
.Ajax()
.ServerOperation(true)
.PageSize(5)
.Read(read => read.Action("GetUpcomingEvents", "ControllerCenter", new { locationID = @ViewBag.locationID })))
.Pageable()
.Columns(cols =>
{
cols.Bound(p => p.eventDate).Format("{0:dd-MMM}").Title("Date");
cols.Bound(p => p.Presenter);
}))
<script>
$(function () {
debugger;
$('#gridUpcomingMTC').data("kendoGrid").dataSource.page(2);
})
</script>
I then have some javascript code which calls the page() function with the number 2, however during this call the controller still receives a 1. What am I doing wrong, or is there another way to set the initial page? Here is the code:
@(Html.Kendo().Grid<SF_SatAppsMVC4.Models.MD_GetUpcomingMTCEventsResult>().Name("gridUpcomingMTC")
.HtmlAttributes(new { @class = "clickableGrid" })
.AutoBind(false)
.DataSource(datasource => datasource
.Ajax()
.ServerOperation(true)
.PageSize(5)
.Read(read => read.Action("GetUpcomingEvents", "ControllerCenter", new { locationID = @ViewBag.locationID })))
.Pageable()
.Columns(cols =>
{
cols.Bound(p => p.eventDate).Format("{0:dd-MMM}").Title("Date");
cols.Bound(p => p.Presenter);
}))
<script>
$(function () {
debugger;
$('#gridUpcomingMTC').data("kendoGrid").dataSource.page(2);
})
</script>