Chapter 8. Using Data-Aware Controls
In Chapter 7, you looked at the go-to control for data access in ASP.NET: the DataSource
control. In this chapter, you’ll look at the various DataSource
-aware controls available out of the box with Visual Studio and how to use them to read and write (tabular) data through a data source.
To begin, you’re going to spend a few moments looking at the rest of the Visual Studio 2008 (VS2008) server control toolbox and consider:
Which controls can be bound to a
DataSource
in the same way you’ve seen theGridView
work in earlier examplesWhether they work with tables, lists, records, or individual pieces of data
Whether they only display data or can use a
DataSource
control to reflect changes back to the original source—a database in this caseWhat other controls exist to which you can bind data, but do not accept
DataSource
objects
Technically speaking, every web form control must understand how to bind data to at least its properties (known as inline binding) because it inherits the DataBind
method as something it must implement from its parent Control
class. Thus, every ASP.NET web form control understands inline binding, and can set its properties to values from a database using the ADO.NET DataBind
method that you’ll look at in Chapter 9.
The question here concerns which controls know how to bind records, lists, or columns of data into their structure through DataSource
controls. The technically accurate answer is the controls derived from System.Web.UI.WebControls.BaseDataBoundControl ...
Get Programming ASP.NET 3.5, 4th 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.