Choose 1 or many

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?
 
C

clintonG

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/
 
H

hussain.saleem

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,591
Members
45,103
Latest member
VinaykumarnNevatia
Top