Working with the DropDownList ControlThe 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.Listing 10.9. ShowDropDownList.aspx
The DropDownList control renders an HTML <select> tag. One problem with the HTML <select> tag is that it has an infinite z index. In other words, you can't place other objects, such as an absolutely positioned <div> tag, in front of a DropDownList control in a page. One way to get around this problem is to use a third-party control such as the EasyListBox control (available at http://www.EasyListBox.com). This control works fine when other objects are layered over it. It also supports several advanced features such as multiple columns and images in list items. |