This example shows how to configure Telerik Grid for ASP.NET MVC to use custom server binding. By default the Grid is using the built-in Linq expression engine. However in some cases you may want to perform the paging, sorting, filtering and grouping by yourself. This examples shows how.
The required steps are:
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.EnableCustomBinding(true)
%>
<%= Html.Telerik().Grid<Order>()
.Name("Grid")
.BindTo(Model)
.EnableCustomBinding(true)
%>
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.EnableCustomBinding(true)
.Pageable(paging => paging.Total((int)ViewData["total"]))
%>
[GridAction]
public ActionResult _CustomBinding(GridCommand command)
{
IEnumerable data = GetData(command);
var dataContext = new NorthwindDataContext();
ViewData["total"] = dataContext.Orders.Count();
return View(data);
}