Web Service Binding
Theme: vista
Bound to ASMX Web Service
Drag a column header and drop it here to group by that column
Bound to WCF Web Service using DTO objects
Drag a column header and drop it here to group by that column
About this example
This example shows how to bind Telerik Grid for ASP.NET MVC to web services.
You need to configure the grid via the DataBinding method
<%= Html.Telerik().Grid<Order>()
.Name("AsmxGrid")
.DataBinding(dataBinding => dataBinding.WebService().Select("~/Models/Orders.asmx/GetOrders"))
.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);
})
.Sortable()
.Pageable()
.Filterable()
.Scrollable()
%>
The web service method should have a parameter of type GridState which represents the current grid state - page,
sort, filter and group expressions.
The web service method may return the GridModel object or any other object which has a Data and Total
properties. To benefit from the built-in Linq expression engine you can use the ToGridModel extension method:
[WebMethod]
public GridModel GetOrders(GridState state)
{
NorthwindDataContext northwind = new NorthwindDataContext();
return northwind.Orders.ToGridModel(state);
}