can javascript do this

P

Paul

I have a .net page where I display a list of items and allow the user to
select one or more items and place the items in another text box as being
selected by clicking an arrow. I currently have two arrows, one to remove
the selected items from the source box and place them in the destination box
and another arrow to take the selected items from the destination box and put
them back in the source textbox. Just wondering if there is a way to do this
without posting back to the server? I
Thanks Paul.
 
G

Gregory A. Beamer \(Cowboy\) - MVP

Yes you can.

There are numerous examples out there. I think the AJAX controls on
www.asp.net have an example of doing exactly what you want. If not there, I
believe it is still somewhere on the ASP.NET site.

You can also use AJAX to avoid the appearance of post back on any pages you
want to seem more dynamic for the user.
 
P

Paul

Yep trying to reduce the number of postbacks on the entire form. I
downloaded the ajax tool kit several months ago so will check it. I am not
sure how often they update the toolkit with new ajax controls but I may need
to grab the newest version.
thanks.
--
Paul G
Software engineer.


Gregory A. Beamer (Cowboy) - MVP said:
Yes you can.

There are numerous examples out there. I think the AJAX controls on
www.asp.net have an example of doing exactly what you want. If not there, I
believe it is still somewhere on the ASP.NET site.

You can also use AJAX to avoid the appearance of post back on any pages you
want to seem more dynamic for the user.
 
G

Gregory A. Beamer \(Cowboy\) - MVP

If you have VS2008, just download SP1 for VS2008 and you have all but the
futures bits included.


Paul said:
Yep trying to reduce the number of postbacks on the entire form. I
downloaded the ajax tool kit several months ago so will check it. I am
not
sure how often they update the toolkit with new ajax controls but I may
need
to grab the newest version.
thanks.
 
P

Paul

still have 2005, found a javascript function that seems to work well for
moving items back and forth between list boxes.
 
G

Gregory A. Beamer \(Cowboy\) - MVP

The cool thing about client side stuff, is you can always upgrade the
backend and still continue to use the client stuff. Glad you found something
that works.
 
P

Paul

Yes there is a lot you can do with client side stuff as well. Still have one
issue, when moving items back to the original listbox it does not preserve
the original order as I need to keep the list in alphebetical order, thinking
may be able to call a javascript function to perform a sort on the items.--
Paul G
Software engineer.
 
P

Paul

I ended up using the following which uses the sort method, although probably
should pass in the name of the list box,
function sortlist() {
var lb = document.getElementById('ListBox1');
arrTexts = new Array();

for(i=0; i<lb.length; i++) {
arrTexts = lb.options.text;
}

arrTexts.sort();

for(i=0; i<lb.length; i++) {
lb.options.text = arrTexts;
lb.options.value = arrTexts;
}
}
 

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
474,159
Messages
2,570,880
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top