O'Reilly logo

C# Primer: A Practical Approach by Stanley B. Lippman

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

7.15. Adding a CheckBoxList Control

This section adds a CheckBoxList control. The motivation is to allow the user to vote for multiple items by clicking on them. The page is pictured in Figure 7.6.

Figure 7.6. A CheckBoxList Control Example

The initialization of the CheckBoxList control is similar to that of the previous two list controls, except that we specify that the check boxes should be displayed in columns of two items per line:

 private void Page_Load(object sender, System.EventArgs e) { if ( ! IsPostBack ) { string [] selections = { "Twelfth Night", "Romeo and Juliet", "Hamlet", "MacBeth", "All\'s Well That Ends Well", "Henry IV, Part ...

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