moving items between list boxes

K

Kay

Hello,

I have two list boxes on my form, one initially displays blank, and through
javascript it is possible to move items from one box to another, this works
fine, I followed an article titled "How to move items between Lists with
Javascript" http://www.devx.com/GetHelpOn/10MinuteSolution/16372. My problem
is that I also have a dropdown list on the page with autopost back = true,
and a procedure to handle the text changed event of the dropdown list; my
problem is as follows: when the user selects an option in the dropdown list
the form is posted back to the server and certain other processing happens,
then when the form redisplays, the items that had been moved between the
list boxes have disappeared. How do I maintain the listboxes on a redisplay?
I need to do an autopostback on the dropdown list. I also have a save button
on the form and I know when the user clicks this, I can retrieve the value
in the listbox by doing a Request.Form("listboxID") on the server, however
the dropdownlist text changed event will occur before the save button is
clicked.

Any idea how I might preserve the users selection in the listboxes when I
present the screen back to them after the drop down list text changed event?

Any help appreciated.
Thanks,
Kay.
 
G

Guest

In this case, because you are doing the manipulation at client side, view state is not updated on page reload and data is being lost from the listbox.

As a solution, you can either execute dual list transfer at server ...but the drawback is that for every element transfer..it will tax a trip to the server.

Another solution (which I've implemented for myself) is make a Dual list Server control and manage the view state for listboxes in the server control itself ...This way you can use the same dual listbox control more then once on the same page...

Hope this gives you direction towards the desired solution....

Regards
Avneesh
 
K

Kay

Hello Avneesh,

Thanks for your suggestion, however I am not exactly sure what you mean when
you say a "Dual list Server control", could you tell me what this means ?

Thanks,
Kay.

Avneesh said:
In this case, because you are doing the manipulation at client side, view
state is not updated on page reload and data is being lost from the listbox.
As a solution, you can either execute dual list transfer at server ...but
the drawback is that for every element transfer..it will tax a trip to the
server.
Another solution (which I've implemented for myself) is make a Dual list
Server control and manage the view state for listboxes in the server control
itself ...This way you can use the same dual listbox control more then once
on the same page...
 
G

Guest

Hi Kay.

By saying "Dual list Server control" , I ment two listbox controls togather, used to transfer values from left one to right one and vise versa.
Actually the Custom control with this feature is called "Dual listbox Server control

Hope it's clear.

Regard
Avnees
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top