Binding Database Data to a DropDownList Web Control

In Hour 11 we examined how to use the DropDownList Web control to display a drop-down list of options in a Web page. The drop-down list, as we discussed, is a means of collecting user input that is limited to one choice from a list of legal choices.

For example, an e-commerce site might use a drop-down list to prompt users for what type of shipping method they want their shipment sent by. Here the options might be U.S. Postal Service, 2-Day UPS, or Overnight FedEx. The drop-down list is a suitable means of collecting user input in this case because the user must choose precisely one shipping option from among the three options.

The options presented to the user in a DropDownList are referred ...

Get SAMS Teach Yourself ASP.NET in 24 Hours now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.