Telerik Extensions for ASP.NET MVC

Version Q2 2012, released 06/07/2012

Ajax Binding

Drag a column header and drop it here to group by that column
No records to display.
Displaying items 0 - 0 of 0

About this example ASPXRazor

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 via the 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);
            })
    %>
  2. The action specified by the 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()));
    }
            

Interested in HTML5 and mobile-powered ASP.NET MVC apps?

Experience the next generation UI and framework for ASP.NET MVC development by downloading trial evaluation copy of Kendo UI Complete for ASP.NET MVC. Jumpstart your development with the available learning resources.

The differences between Telerik MVC Extensions and Kendo UI Complete for ASP.NET MVC, and their licensing models are explained here and here.

If you have any questions, do not hesitate to contact us at sales@telerik.com.

Other Demos: