Binding to a Data Source

You can bind any of the List controls to a data source. The List controls support both declarative databinding and programmatic databinding.

For example, the page in Listing 10.2 contains a DropDownList control bound to the Movies database table with declarative databinding (see Figure 10.2).

Figure 10.2. Displaying list items with declarative databinding.

image

Listing 10.2. DeclarativeDataBinding.aspx

images

The DropDownList control’s DataSourceID property points to the ID of the SqlDataSource control. When you open the page in ...

Get ASP.NET 4 Unleashed 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.