This example shows how to configure Telerik Grid for ASP.NET MVC to use custom 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 and filtering by yourself. This examples shows how.
The required steps are:
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.EnableCustomBinding(true)
%>
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.EnableCustomBinding(true)
.Pageable(paging => paging.Total((int)ViewData["total"]))
%>
[GridAction(EnableCustomBinding = true)]
public ActionResult _CustomBinding(GridCommand command)
{
IEnumerable<Order> data = GetData(command);
var dataContext = new NorthwindDataContext();
return View(new GridModel { Data = data, Total = dataContext.Orders.Count() });
}