Working with the DropDownList Control

The DropDownList control enables you to display a list of options while requiring a minimum of screen real estate. A user can select only one option at a time when using this control.

The page in Listing 10.9 illustrates how you can use the DropDownList control to display all the movie titles from the Movies database table (see Figure 10.8).

Figure 10.8. Displaying list items with the DropDownList control.

image

Listing 10.9. ShowDropDownList.aspx

images

The DropDownList control renders an HTML <select> tag. One problem ...

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.