Data Source Controls

In this article, we explore the role of Data Source Controls in building web applications. In addition to this we will understand the functionality of these Data Source Controls. These Data Controls have been preferred choices for faster development.

Preface:

We develop web applications using various type of controls and all of these controls are subsequently rendered into the HTML version.

First, we will understand a basic approach (architecture) of a data web application. We are not going to discuss here the Tier vs. Layer but will see the data source controls framing in 3 or n-layered architecture. An application is architectured depending on the requirements, technical resources, manpower, time, cost and future scope. So, maintainability is directly related to these factors and correspondingly architectured structuring. For functionality, creating more layers does not yield faster results and fewer layers are slower. It's all about the time & scope with money & security.

simpleApplicationArchitecture.png

In simple terms, applications store & serve data to end user. They store it in data storage and display (serve) it in web browsers. There is some internal mechanism that mediates or facilitates and fits between thm. To improve maintainability we can logically separate/divide this facilitator/mediater into many parts.

SimpleLayer.png

As stated above, we are not going into depth about Tiers & Layers but will just have an idea of database applications.  We will start with the Presentation or binding of data with controls and then proceed to data access mechanisms or layers.  

In simple terms, a Data Access Layer fetches data from the data storage. This data storage could be anything, such as SQL Server, MySQL, Access, File etc. Fetching data from different data storage requires exposure of that. We use many techniques to fetch data from data storage. There are already re-usable code that can be used for this purpose. There are many choices. For the purpose of providing better approaches for building web application, Microsoft is providing many techniques to handle this hurdle. A person needn't be experienced with that data storage but he can use these data access frameworks for data handling. In fact Microsoft provides a single approach to access any kind of data storage and convenience in the programming arena. In background these frameworks are very intelligent for accessing and implementing the code corresponding to the data storage type. We will see these data access frameworks in the next tutorial.

The scope of this article is limited to the Presentation Layer's controls. There are many controls for doing our stuff to show the data to the web user. There are mainly two categories of Microsoft controls (in terms of data associability) in .Net web development:

  1. Data bound controls and
  2. Non-Data bound controls.

We bind data sources to data bound type controls and they do the required job for us, for example GridView etc.

There is one more type of control that is able to work as a bridge with these data bound controls, and that is DataSource controls.  Data source controls play an important role in Rapid Application Development. These controls provide the functionality of Paging, Sorting and Filtering of records. We will analyse these data source controls on the basis of their scope and features in the next article. The following is the list of these DataSource controls with their ability for Paging and Sorting.

datasourcelist.png

These data source controls are heavily used since they save time and reduce the amount of coding required for the same functionality. We can pick these controls depending on our data storage. For example if we want to access data from XML source then we will use XmlDataSource. SqlDataSource is more popular in the case of SQL clients. But it is used in 2-layer architecture applications. ObjectDataSource is widely used in larger applications since it provides very good support for Paging and Sorting. It has more features associated with it. It is a highly customizable data source control. It doesn't have data storage type restrictions like XmlDataSource or SqlDataSource.

Wrap up:

Data Source Controls are preferred in Rapid Application Development of web applications. It plays an important role in data display with common functionalities like Paging, Sorting and Filtering without writing much code.

Up Next
    Ebook Download
    View all
    Learn
    View all