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:

  1. Configure the Grid to use Ajax binding using the Ajax method. It has a few overloads but in the simplest form it requires action and controller name:
    <%= Html.Telerik().Grid<Order>()
            .Ajax(ajax => ajax.Action("_AjaxBinding", "Grid"))
            .Name("Grid")
            .Columns(columns =>
            {
                columns.Add(o => o.OrderID).Width(81);
                columns.Add(o => o.Customer.ContactName).Width(200);
                columns.Add(o => o.ShipAddress);
                columns.Add(o => o.OrderDate).Format("{0:MM/dd/yyyy}").Width(100);
            })
    %>
  2. The action specified by the Ajax 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<Order>
        {
            Data = GetOrders()
        });
    }