Telerik is a leading vendor of ASP.NET AJAX, ASP.NET MVC, Silverlight, WinForms and WPF controls and components, as well as .NET Reporting, .NET ORM , .NET CMS, Code Analysis, Mocking, Team Productivity and Automated Testing Tools. Building on its expertise in interface development and Microsoft technologies, Telerik helps customers build applications with unparalleled richness, responsiveness and interactivity. Telerik products help thousands of companies to be more productive and deliver reliable applications under budget and on time.
select

Grid / .NET 3.5 Client-side Data Binding

Rate this demo: Feedback
Run example in: C# VB.NET Change Skin:
Vista
  • BlackBlack
  • DefaultDefault
  • ForestForest
  • HayHay
  • Office2007Office2007
  • OutlookOutlook
  • SimpleSimple
  • SitefinitySitefinity
  • SunsetSunset
  • TelerikTelerik
  • VistaVista
  • Web20Web20
  • WebBlueWebBlue
  • Windows7Windows7


RadGrid bound to WCF Web Service

RadGrid bound to ADO.NET Data Service

Example Source Code & Description

Instructions
Open in new window
  • This example demonstrates declarative client-side data-binding of RadGrid for ASP.NET AJAX to WCF Web Service and ADO.NET Data Service. Both RadGrids have enabled paging/sorting/filtering.

    The first RadGrid is bound to WCF Web Service. You need to point the control to an existing web service and method with following signiture:

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

    [OperationContract]
    public ResultData GetDataAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression)

    where ResultData is custom class that holds data returned from the service to client:

    public class ResultData
    {
     public int Count { get; set; }
     public List<Product> Data { get; set; }
    }

    The second RadGrid is bound to ADO.NET Data Service. You need to point the control to an existing data service and set the following settings:

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

    and GetCount method:

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

    More information about how to bind the grid to these types of services you can gather from the relevant help article:
    Client binding with WCF service/ADO.NET Data Services

Compatible with ASP.NET 2.0, 3.5 AJAX enabled Accessibility Verified!Accessibility Verified!Valid XHTML 1.1! Optimized for Visual Studio 2005, 2008
Copyright 2002-2010 © Telerik. All right reserved  | 
Telerik Inc., 460 Totten Pond Rd, Suite 640, Waltham, MA 02451

www.telerik.com  |  Terms of Use  |  Contact Us