The following sections explain the client data source implemented in ClientBinding.
There are three general types of client data source:
- Server-side Data Source and Data Service.
- Service-based data source.
ClientBinding includes three built-in data providers implementation for data service, which are Web Service, WCF Service and ADO Data Service. - Client-side data source.
Server-side data source
This data source type enables you to continue using server-side data source in WebGrid. Supported server-side data source are:
- Datasource controls, such as AccessDataSource, LinqDataSource, ObjectDataSource, etc.
- Datasource object, which is assigned in InitializeDataSource event (also known as Traditional Binding).
This data source type is designed to help you leverage and reuse existing infrastructure which has used server-side data source, while at the same time enables you to take advantage of many client binding benefits such as improved performance and reduced data footprint.
To learn the difference between server-side binding mode and client-side binding mode with server-side datasource type, please see The Difference with Server-side Binding.
Server-side data source type is the quickest and easiest way to take advantage of client-side binding. You don't need to create web service or data service as WebGrid seamlessly connects to server-side data source for data retrieval, which is then repackaged into lightweight format for further processing in the client-side.
Web Service
WebService data source type enables you to connect WebGrid to a web service in elegant fashion, which is done through properties configuration without requiring any Javascript codes.
To connect WebGrid to a web service, simply specifies the service address in the provided ServiceUrl property and specifies the web method used to retrieve data in SelectMethod property. |
WebService will automatically activate full client-side operation mode when your data service returns all data. It also supports paged data retrieval for optimized performance.
WebService fully supports data transaction operations such as insert, update, and delete. It also supports more advanced operation such as batch update.
Markup example:
Code | Copy Code |
---|---|
<ClientBindingSettings DataSourceType="WebService" ServiceUrl="~/Service1.asmx"> <ServiceMethods SelectMethod="GetData"/> </ClientBindingSettings> |
Important: Your web service should have capability to return output in JSON format as client binding will accept only data in JSON format. If you're developing web service in ASP.NET 3.5, then your web service has supported JSON response format.
Windows Communication Foundation (WCF) Service
WcfService data source type enables you to connect WebGrid to a Windows Communication Foundation service in elegant fashion, which is done through properties configuration without requiring any Javascript codes.
To connect WebGrid to a WCF service, simply specifies the service address in the provided ServiceUrl property and specifies the web method used to retrieve data in SelectMethod property. |
WcfService will automatically activate full client-side operation mode when your data service returns all data. It also supports paged data retrieval for optimized performance.
WcfService fully supports data transaction operations such as insert, update, and delete. It also supports more advanced operation such as batch update.
Markup example:
Code | Copy Code |
---|---|
<ClientBindingSettings DataSourceType="WcfService" ServiceUrl="~/WcfService.svc"> <ServiceMethods SelectMethod="GetData"/> </ClientBindingSettings> |
Important: Your web service should have capability to return output in JSON format as client binding will accept only data in JSON format. If you're developing WCF service in ASP.NET 3.5, then your web service has supported JSON response format.
ADO.NET Data Service (Astoria)
ADO.NET Data Service is Microsoft's latest data service technology introduced in .NET Framework 3.5 SP1. It enables data to be consumed programmatically through standard Web protocols such as REST, XML, SOAP and JSON. To learn more about ADO.NET Data Service, please visit ADO.NET Data Service Home.
Intersoft's ClientBinding™ is the first in the industry that implement full support for this cutting-edge technology.
To connect WebGrid to an ADO.NET data service, all you need to do is specifying the service address in the provided ServiceUrl property. |
Astoria enables programmatic data access over the Web with very minimal efforts, which includes support for sorting, filtering and paging. It also includes native support for data transactions such as insert, update, delete, as well as more advanced operation such as batch update.
ClientBinding™ fully takes advantage of Astoria capabilities and implement direct interface to access Astoria's functionalities. As a result, you are not required to specify any of the service methods.
The following example shows a simple declarative markup to enable all data operations.
Code | Copy Code |
---|---|
<ClientBindingSettings DataSourcetype="AdoDataService" ServiceUrl="~/WebDataService1.svc" ItemTypename="Customer"> </ClientBindingSettings> |
The current version of Astoria doesn't support complete paging feature yet. Therefore, you can only use AllData loading mode when using AdoDataService type. |
Client-side data source
Client data source type allows you to assign a completely custom data source in client-side. When this type is used, WebGrid doesn't perform data loading automatically as the required datasource is not available.
This type is specifically useful when you need to retrieve datasource from external sites or data services that are not supported in Intersoft's ClientBinding. For example, you may have a requirement to fetch data from an external site manually in the client-side, and then pass the resulted data to WebGrid via API calls for data binding.
Pure client-side binding takes as little as three lines of code, such as shown in the following:
grid.SetDataSource(dataSource);
grid.DataBind();
grid.Render();
WebGrid accepts ISDataSet, ISDataTable or any array-based collection as data source. For more information about client binding API, please see Client Binding API.
Getting Started
Getting Started
Overview
WebGrid Features Overview
Other Resources
Walkthrough Topics
How-to Topics