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"%>> ... |
Get ASP.NET by Example 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.