New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial

Client Binding to WCF Web Service and ADO.NET Data Service

Updated on Oct 7, 2026

Starting with ASP.NET 3.5, the .NET Framework provides two ways to supply data to ASP.NET server controls: binding to Windows Communication Foundation (WCF) Web Services and binding to ADO.NET Data Services. These services support asynchronous calls that retrieve data, return it to the client, and update the controls based on the result sent by the service. The following tutorials provide step-by-step instructions for configuring these services in Visual Studio:

WCF services getting started tutorial

Using Microsoft ADO.NET Data Services

RadGrid for ASP.NET AJAX provides a declarative way to bind to data returned by a WCF Web Service or an ADO.NET Data Service, as shown in the client binding demo. Both grids in the example support paging, sorting, and filtering without additional code.

Binding RadGrid for ASP.NET AJAX to WCF Web Service

For the first RadGrid, which is bound to a WCF Web Service, specify an existing service and a method with the following signature:

Example: Configuring client-side WCF data binding

ASP.NET
<ClientSettings>
    <DataBinding SelectMethod="GetDataAndCount" Location="GridWcfService.svc"
        SortParameterType="Linq" FilterParameterType="Linq">
    </DataBinding>
</ClientSettings>

ResultData is a custom class that holds data returned from the service. The signature of this class and the GridWcfService.svc file used in the demo are shown below:

ASP.NET
<%@  servicehost language="C#" debug="true" service="GridWcfService" codebehind="~/App_Code/GridWcfService.cs" %>

Binding RadGrid for ASP.NET AJAX to ADO.NET Data Service

The second RadGrid from the online example referenced above is bound to ADO.NET Data Service. You need to point an existing ADO.NET data service to generate the grid content and specify the following settings:

ASP.NET
<ClientSettings>
    <DataBinding Location="GridAdoNetDataService.svc" SelectCountMethod="GetCount">
   	    <DataService TableName="Products" />
    </DataBinding>
</ClientSettings>

Define the GetCount method as follows:

C#
[WebGet]
public int GetCount(string where)
{
    return String.IsNullOrEmpty(where) ? CurrentDataSource.Products.Count() : CurrentDataSource.Products.Where(where).Count();
}

The ADO.NET Data Service class and the GridAdoNetDataService.svc file from the sample use the following syntax:

ASP.NET

<%@ ServiceHost Language="C#" Factory="System.Data.Services.DataServiceHostFactory" Service="GridAdoNetDataService" %>
C#
using System;
using System.Data.Services;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Web;
using EntityFramework;
public class GridAdoNetDataService : DataService<NorthwindEntities>
{    
   public static void InitializeService(IDataServiceConfiguration config)
   {        
        config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
        config.SetServiceOperationAccessRule("*", ServiceOperationRights.All);
   }
   [WebGet]
   public int GetCount(string where)
   {
       return String.IsNullOrEmpty(where) ? CurrentDataSource.Products.Count() :
           CurrentDataSource.Products.Where(where).Count();
   }
} 			

See Also