Planet For Application Life Development Presents
MY IT World

Explore and uptodate your technology skills...

ASP.NET - Data Binding

Every ASP.Net web form control inherits the DataBind method from its parent Control class, which gives it an inherent capability to bind data to at least one of its properties. This is known as simple data binding or inline data binding.

Simple data binding involves attaching any collection (item collection) which implements the IEnumerable interface, or the DataSet and DataTable classes to the DataSource property of the control.

On the other hand, some controls can bind records, lists, or columns of data into their structure through a DataSource control. These controls derive from the BaseDataBoundControl class. This is called declarative data binding.

The data source controls help the data-bound controls implement functionalities like, sorting, paging and editing data collections. We have already seen declarative data binding in the previous tutorial.

The BaseDataBoundControl is an abstract class, which is inherited by two more abstract classes:

  • DataBoundControl

  • HierarchicalDataBoundControl

The abstract class DataBoundControl is again inherited by two more abstract classes:

  • ListControl

  • CompositeDataBoundControl

The controls capable of simple data binding are derived from the ListControl abstract class and these controls are:

  • BulletedList

  • CheckBoxList

  • DropDownList

  • ListBox

  • RadioButtonList

The controls capable of declarative data binding (a more complex data binding) are derived from the abstract class CompositeDataBoundControl. These controls are:

  • DetailsView

  • FormView

  • GridView

  • RecordList