Data Bind Controls in ASP.NET

ASP.NET allows powerful feature of data binding, you can bind any server control to simple properties, collections, expressions and/or methods. When you use data binding, you have more flexibility when you use data from a database or other means.

Data Bind controls are container controls.

Controls -> Child Control

Data Binding is binding controls to data from databases. With data binding we can bind a control to a particular column in a table from the database or we can bind the whole table to the data grid.

Data binding provides simple, convenient, and powerful way to create a read/write link between the controls on a form and the data in their application.

Data binding allows you to take the results of properties, collection, method calls, and database queries and integrate them with your ASP.NET code. You can combine data binding with Web control rendering to relieve much of the programming burden surrounding Web control creation. You can also use data binding with ADO.NET and Web controls to populate control contents from SQL select statements or stored procedures.

Data binding uses a special syntax:

<%# %>

The <%#, which instructs ASP.NET to evaluate the expression. The difference between a data binding tags and a regular code insertion tags <% and %> becomes apparent when the expression is evaluated. Expressions within the data binding tags are evaluated only when the DataBind method in the Page objects or Web control is called.


Data Bind Control can display data in connected and disconnected model.

Following are data bind controls in ASP.NET:

  • Repeater Control
  • DataGrid Control
  • DataList Control
  • GridView Control
  • DetailsView
  • FormView
  • DropDownList
  • ListBox
  • RadioButtonList
  • CheckBoxList
  • BulletList
  • etc.

To display backend result set (tuple collection) Repeater Control, DataGrid Control, DataList Control, GridView Control are used.

Repeater Control, DataList Control and FormView Control are unformatted controls.

DetailsView and ForView controls display single tuple result at a time.
DropDownList, ListBox, RadioButtonList, CheckBoxList and BulletList controls displays single column values.

There are three types of binding:

  • Declarative Binding
  • Static Binding
  • Programmatically Binding


I will discuss in detail about these data bind controls and types of binding in my coming articles. This article is to make you familiar with what is data binding and a little about its controls.

Conclusion

I hope that this article would have helped you in understanding the Data Bind Controls in ASP.NET. Please share it if you know more about this article. Your feedback and constructive contributions are welcome.


Similar Articles