By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,226 Members | 1,193 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,226 IT Pros & Developers. It's quick & easy.

moving items between list boxes

P: n/a
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.
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

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
Nov 18 '05 #2

P: n/a
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" <av*****@helloprojects.com> wrote in message
news:2B**********************************@microsof t.com...

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

Nov 18 '05 #3

P: n/a
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

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.