Several ASP controls allow the user to select a value or values:
Allows selection of Boolean data
Allows only a single option to be selected
Group of CheckBox controls that can be dynamically created and bound to a data source
Group of RadioButton controls that can be dynamically created and bound to a data source
Allows selection of one or more items from a predefined list
Similar to a ListBox, but allows only a single selection
All of these controls derive from the WebControl class. The RadioButton derives further from the CheckBox class, and the last four controls, the List controls, all derive from the abstract ListControl class. Each of these controls is considered in detail in the upcoming sections.
A CheckBox control provides a means for a user to select Boolean data (i.e., Yes/No or True/False). If you have several checkboxes arranged together (not to be confused with a CheckBoxList), then you can select multiple options. No option is mutually exclusive of another.
The C# code in Example 5-10 shows the use of three independent CheckBoxes to control the appearance of a Label. (The equivalent VB.NET code, which is nearly identical to the C# code, is shown in Example 5-11.) Clicking on any of the checkboxes in these examples -- Underline, Overline, or Strikeout -- imposes that attribute on the text string in the Label control. The results of the C# code are shown in Figure ...
No credit card required