SIGN UP MEMBER LOGIN:    
ARTICLE

Data Bind Controls in ASP.NET

Posted by Puran Mehra Articles | ASP.NET Controls in C# September 30, 2009
In this article I will explain what is Data Binding in a simple manner. The article is targeted to beginners.
Reader Level:

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 detailed 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.
 

Login to add your contents and source code to this article
share this article :
post comment
 

Sir,
        How to make use of checkboxes in a grid to select a row and display the row in a new grid on a click of a show details button? i am making use of asp.net and c# and oracle 10g database.
thanks and regards

Posted by pes Apr 01, 2010
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor