Hi,
I want to use server side paging for grid in my project. I was unable to achieve that. Could you provide any working sample of code. Below is my code.
@{Html.Kendo().Grid<ViewModels.GridModel>()
.Name("grdTasks")
.Columns(columns =>
{
columns.Bound(o => o.ActionItemId)
.Hidden(true);
columns.Bound(o => o.StudyNo)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemStudy")
.ToHtmlString())
.Width(75)
.HtmlAttributes(new { @class = "gridRowLeftAligned", style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none; font-family:Arial text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
columns.Bound(o => o.SiteName)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemSite")
.ToHtmlString())
.Width(95)
.HtmlAttributes(new { @class = "gridRowLeftAligned" ,style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none;font-family:Arial;text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
columns.Bound(o => o.AssignedToName)
.Title(@Html.GetResourceValue("DashboardWidget.TaskTracking", "AI_UI_Label_ActionItemAssignedto")
.ToHtmlString())
.Width(85)
.HtmlAttributes(new { @class = "gridRowLeftAligned", style = "color:black;" })
.HeaderHtmlAttributes(new { @class = "gridHeaderRow", style = "border:none; font-family:Arial;text-align:left;font-size: 12px; " })
.Filterable(false)
.Sortable(true);
})
.NoRecords(@<text>Loading...</text>)
.DataSource(dataSource => dataSource.Ajax()
.Read(read => read.Action("GrdActionListAjaxBindingKendo", "ActionItem", new { filterKey = (string)ViewData["filterKey"] }))
.Model(model => model.Id(site => site.StudyId))
.PageSize((int)ViewData["pageSize"])
.Total((int)ViewData["totalRecords"])
.ServerOperation(true)
)
.EnableCustomBinding(true)
.Events(events=>events.DataBound("Tasks_OnDataBound"))
.Sortable()
.Scrollable()
.HtmlAttributes(new { style = "font-size:10px; font-weight:bold; font-family:Arial; width:100%;" })
.Pageable(page => page.Enabled(true).PageSizes(new Int32[] { 20, 30, 50, 100 }))
.Render();
Here datais binding properly only for the first time. But based on Total records grid has to display paging info. It is not doing that.
Could you help me.