Chapter 11. Data Binding in ASP.NET 2.0

One of the most exciting features of ASP.NET 1.0/1.1 was its capability to bind entire collections of data to controls at runtime without requiring you to write large amounts of code. The controls understood they were data-bound and would render the appropriate HTML for each item in the data collection. Additionally, you could bind the controls to any type of data sources, from simple arrays to complex Oracle database query results. This was a huge step forward from ASP, in which each developer was responsible for writing all the data access code, looping through a recordset, and manually rendering the appropriate HTML code for each record of data.

In ASP.NET 2.0, Microsoft has taken the concept of data binding and expanded it to make data binding even easier to understand and use. ASP.NET 2.0 introduces a new layer of data abstraction called data source controls. This chapter explores all the provided data source controls, as well as describing other ASP.NET 2.0 data-binding changes. It shows how you can use the data source controls to easily and quickly bind data to data-bound controls. This chapter also focuses on the power of the new data-bound list controls included in ASP.NET 2.0, such as the GridView, DetailsView, and FormView controls. Finally, you take a look at changes in the inline data binding syntax and inline XML data binding.

Data Source Controls

In ASP.NET 1.0/1.1, you typically performed a data-binding operation by writing some ...

Get Professional ASP.NET 2.0 Special Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.