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
DataSourcein the same way you’ve seen theGridViewwork in earlier examplesWhether they work with tables, lists, records, or individual pieces of data
Whether they only display data or can use a
DataSourcecontrol 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
DataSourceobjects
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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access