|
 |
asp_web_howto thread: Sort a List Box
Message #1 by "Rita Greenberg" <rg1@h...> on Tue, 27 Mar 2001 17:54:33
|
|
Hi.
Is there a way to sort a List Box? The List Box starts out initially
sorted, but the user can remove Options to another List Box and then move
them back.
TIA.
Rita
Message #2 by "Peter Lanoie" <planoie@e...> on Tue, 27 Mar 2001 17:28:01 -0500
|
|
Rita,
In reponse to both your questions:
I don't know of any way to sort a list box aside from creating a sort
yourself. You could do a normal bubble sort routine to rearrange the options
each time you add one to the select box.
On the reset button issue: The reset button should do nothing but change
the options back to the state they were in when the page was loaded. I.E.
those options that were selected become selected, and vice versa. What you
can do when the reset button is called is (with the onclick handler) call a
routine that performs escentially a 'select all' then call the routine to
move them to the other select box. This would return the 2 boxes to their
original state with the left containing all the options from the DB query,
and the right being empty. Otherwise, you might as well just refresh the
whole page.
It should be easy enough to do a loop to select each option, then run the
"move left" routine.
HTH.
Peter
-----Original Message-----
From: Rita Greenberg [mailto:rg1@h...]
Sent: Tuesday, March 27, 2001 12:55 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Sort a List Box
Hi.
Is there a way to sort a List Box? The List Box starts out initially
sorted, but the user can remove Options to another List Box and then move
them back.
TIA.
Rita
Message #3 by Rita Greenberg <rg1@h...> on Wed, 28 Mar 2001 07:24:32 -0800
|
|
Yes, your explanation helps a lot!
Thanks.
-----Original Message-----
From: Peter Lanoie [mailto:planoie@e...]
Sent: Tuesday, March 27, 2001 2:28 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Sort a List Box
Rita,
In reponse to both your questions:
I don't know of any way to sort a list box aside from creating a sort
yourself. You could do a normal bubble sort routine to rearrange the options
each time you add one to the select box.
On the reset button issue: The reset button should do nothing but change
the options back to the state they were in when the page was loaded. I.E.
those options that were selected become selected, and vice versa. What you
can do when the reset button is called is (with the onclick handler) call a
routine that performs escentially a 'select all' then call the routine to
move them to the other select box. This would return the 2 boxes to their
original state with the left containing all the options from the DB query,
and the right being empty. Otherwise, you might as well just refresh the
whole page.
It should be easy enough to do a loop to select each option, then run the
"move left" routine.
HTH.
Peter
-----Original Message-----
From: Rita Greenberg [mailto:rg1@h...]
Sent: Tuesday, March 27, 2001 12:55 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Sort a List Box
Hi.
Is there a way to sort a List Box? The List Box starts out initially
sorted, but the user can remove Options to another List Box and then move
them back.
TIA.
Rita
|
|
 |