Using the RadioButtonList Web Control
In the previous section we saw how to bind database data to a DropDownList Web control.
Along with being able to bind data to a DropDownList, database data can also be bound to a list of radio buttons and a list of checkboxes. In Hour 11 we examined the CheckBox and RadioButton Web controls, which could be used to create a single checkbox or radio button, respectively.
In Hour 11 we had to add a RadioButton Web control for each radio button we wanted to add to the page. While this approach works for situations where we know precisely the number of radio buttons we want on the page, it doesn't work when we need a variable number of radio buttons. For example, we could redo the example we examined in the previous ...
Get SAMS Teach Yourself ASP.NET in 24 Hours 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.