Intersoft WebGrid Documentation
Codeless Data Binding
See Also Send comments on this topic.
Intersoft WebGrid > WebGrid Features Overview > Displaying Data > Server-side Binding > Codeless Data Binding

Glossary Item Box

WebGrid supports a number of ways to bind data from the database to the control. One of the most common ways to bind data to WebGrid is through the datasource controls which are introduced in latter version of ASP.NET. The datasource controls allow you to bind data in declarative manner, without requiring you to write a single line of code. 

This topic contains the following sections:

Introduction

Codeless data binding means that you can configure the DataSource, its connection and its related property without writing codes. In other words, you can quickly configure the WebGrid to connect to a DataSource by simply using drag, drop and click. Declaratively, you can create a WebGrid instance and bind it to a table in your SQL database in two simple statements as in the following:

Code Copy Code
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
ConnectionString="<$ ConnectionStrings:SqlConnectionString >" 
SelectCommand="SELECT * FROM [Tasks]">
</asp:SqlDataSource>
<ISWebGrid:WebGrid ID="WebGrid1" runat="server" 
DataSourceID="SqlDataSource1" Height="300px" HorizontalAlign="NotSet" Width="100%">
</ISWebGrid:WebGrid>

As you can see on the above statements, the WebGrid1 control is bound to a DataSource control through DataSourceID property. The WebGrid control connects to the specified DataSource control and displays data from the DataSource available in SqlDataSource1.

With this new data binding concept, programming databind web application is very easy, simple and straightforward. Also, notice that there are no codes required in the page's code behind. In previous version, you will need to configure InitializeDataSource event and write codes inside the event which pass the DataSource to e.DataSource. That is no longer needed in WebGrid version 5.0, although the old data binding mechanism is still supported for backward compatibility.
The new DataSource control binding architecture supersedes the older DataSource object binding mechanism and dramatically changes the concept of how a user interface component should interact and handle DataSource. To learn more about its differences and benefits, please refer to The benefits of new DataSource control binding support.
In WebGrid, there are two major categories of DataSource control supported:

Basic DataSourceControl support

WebGrid supports basic DataSource control that is available in ASP.NET 2.0 such as:


Three of the DataSource controls above support single table view and thus can only be used as flat configuration in WebGrid control.

Advanced DataSourceControl support

In addition to basic DataSource controls, WebGrid is designed to handle more advanced DataSource controls for enterprise development needs. The advanced DataSource controls supported are:

XMLDataSource control is a DataSource control designed to retrieve data from XML source. WebGrid control implements a special support for XMLDataSource so that it can read the XML source defined in the XMLDataSource and display it in a tree-like layout.

Note that the XMLDataSource control supported in WebGrid is a lightweight implementation that designed to simulate a TreeView control and thus can be used only for basic display purpose. For more advanced features of TreeView control, please refer to Intersoft's WebTreeView control.
There are several limitations in WebGrid when bound to XMLDataSource control:

To bind to a XmlDataSource control, WebGrid comes with full design-time support that allows you to easily configure the data binding. To learn more about design-time support for XMLDataSource, please refer to Design-time support: XML DataSource control.

The other advanced DataSource control supported by WebGrid is hierarchical (multi table views) DataSource control that enables you to easily connect the WebGrid control to a relational dataset available in your web application without any codes.

The hierarchical DataSource control named ISDataSource is exclusively developed by Intersoft Solutions to support the hierarchical feature of WebGrid while conforming the DataSource control architecture offered in ASP.NET 2.0.
To learn more about ISDataSource and its advanced capabilities, please refer to ISDataSource documentation. To learn more about using ISDataSource in WebGrid, please refer to Hierarchical Binding.

About ISDataSource Licensing in WebGrid

Intersoft DataSource Control, also known as ISDataSource, is sold as standalone component product that requires its own runtime license key. However, since ISDataSource plays a very important role in WebGrid's data access functionality, ISDataSource is provided at no additional cost when used together with WebGrid.

When ISDataSource detects a valid license of WebGrid in a web application, it will automatically functioning as licensed version. In this case, you are not required to set the runtime license key for ISDataSource in the application's web.config.

If you would like to use ISDataSource in a web application that does not contain WebGrid (also known as standalone mode), you would need a separate license to use ISDataSource. There are numerous standalone scenarios where ISDataSource is best used:

The Benefits of the DataSource Control Binding

Here are the benefits of the new DataSource control binding support:

Several important notes that developer should aware with the new DataSource control concept:

See Also

©2012 Intersoft Solutions Corp. All Rights Reserved.