This example shows how to configure Telerik Grid for ASP.NET MVC to perform Ajax requests for paging, sorting and filtering. This operation mode is referred to as "Ajax binding".
The required steps are:
DataBinding method:
<%= Html.Telerik().Grid<Order>()
.DataBinding(dataBinding => dataBinding.Ajax().Select("_AjaxBinding", "Grid"))
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(81);
columns.Bound(o => o.Customer.ContactName).Width(200);
columns.Bound(o => o.ShipAddress);
columns.Bound(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(100);
})
%>
Select method should be decorated with the GridAction attribute.
It also should use the GridModel class as a model. Those are required to process the model data using the
built-in Linq expression engine and return the result in JSON format. If the GridAction attribute is missing
the regular view will be rendered instead of JSON.
[GridAction]
public ActionResult _AjaxBinding()
{
return View(new GridModel(GetOrders()));
}