O'Reilly logo

ASP.NET by Example by Steven A. Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Databinding and List Controls

Up to this point, we've introduced all four types of ASP.NET list controls and you learned how to manipulate each programmatically. In the next section, you'll learn how to automatically create the items in a list from an external data source and bind a list selection to that data source. Before we begin, let's take a quick look back at how we would databind list controls in previous versions of ASP.

For all its strengths, there are some aspects of previous versions of ASP that are just plain awkward. Take the code in Listing 6.12, for instance.

Listing 6.12. Databinding <select> tag in previous versions of ASP.
 <SELECT NAME="STATUS"> <OPTION VALUE="PENDING" <%If rs("Status") = "PENDING" Then Response.Write "selected"%>> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required