Choose 1 or many

  • Thread starter Thread starter dancer
  • Start date Start date
D

dancer

I'm using ASP.Net and VB.net

I have 18 choices - 18 checkboxes. The user can choose 1, a few, or all.
What is the best structure to record and write the response? Select/Case
statement? Or is that only for ONE choice?
 
I prefer a hybrid solution which I have found useful. The outer statement
will often use a single if branching logic statement to determine if any
selections have been made. Within the if statement block I then use the
switch statement as each successive case can be passed conditional logic and
is easier to read, modify and maintain than continuing to nest if branching
logic statements.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
 
I'm using ASP.Net and VB.net

I have 18 choices - 18 checkboxes. The user can choose 1, a few, or all.
What is the best structure to record and write the response? Select/Case
statement? Or is that only for ONE choice?

use one event handler for all checkboxes, check the sender - checkbox
control - TagName property. Make sure you set the TagName property for
each check box to unique id. Use that id as key to store the check/
unchecked boolean value in hash table or any other collection.
 
Back
Top