Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Copying data from one server control ListBox to another using client-side scripts

Reply
Thread Tools

Copying data from one server control ListBox to another using client-side scripts

 
 
Shary
Guest
Posts: n/a
 
      12-07-2004
I have two ListBox server controls on a webform. ListBox1 is bound to
a dataset in the Page_Load method and displays a list of All
Departments. The user can click on an 'Add' button to add departments
from ListBox1 to an adjacent ListBox2 that displays 'Selected
Departments'. ListBox2 is also bound to a dataset in the Page_Load
method.
Every time the user clicks the 'Add' button, a post-back event fires
that adds the selected department in ListBox1 to the Dataset bound to
ListBox2 and then updates ListBox2 to display the newly added
department.
The problem is that the user may want to add 10 or more departments
and I don't want to do a postback each time.
I would like to use a client-side script that copies the selected
department to ListBox2 without doing a postback and once the user
clicks the 'Save changes' button, a postback event is fired that
updates the changes on the server side.
Can someone please tell me if this is do-able or maybe there is an
even better way to tackle this issue. Thanks.
 
Reply With Quote
 
 
 
 
shehan
Guest
Posts: n/a
 
      12-07-2004
Hopefully this should solve all your problems :
http://www.mattkruse.com/javascript/...box/index.html

Cheers,
Shehan

 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      12-07-2004
Hey Shary,

You'll want to check out this free control:

"The DualList is a control designed for the passing items from an available
list of items to a "chosen" list of items. "

http://www.metabuilders.com/Tools/DualList.aspx

"Shary" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
>I have two ListBox server controls on a webform. ListBox1 is bound to
> a dataset in the Page_Load method and displays a list of All
> Departments. The user can click on an 'Add' button to add departments
> from ListBox1 to an adjacent ListBox2 that displays 'Selected
> Departments'. ListBox2 is also bound to a dataset in the Page_Load
> method.
> Every time the user clicks the 'Add' button, a post-back event fires
> that adds the selected department in ListBox1 to the Dataset bound to
> ListBox2 and then updates ListBox2 to display the newly added
> department.
> The problem is that the user may want to add 10 or more departments
> and I don't want to do a postback each time.
> I would like to use a client-side script that copies the selected
> department to ListBox2 without doing a postback and once the user
> clicks the 'Save changes' button, a postback event is fired that
> updates the changes on the server side.
> Can someone please tell me if this is do-able or maybe there is an
> even better way to tackle this issue. Thanks.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drag from one listbox to another listbox bh_jodokast ASP .Net 0 10-07-2005 08:28 PM
Listbox selection to populate another listbox? Chris Kettenbach ASP .Net 3 06-16-2005 09:19 PM
Listbox item added with client scripts not submitting with ASP:Listbox Simon Prince ASP .Net 2 10-19-2004 04:11 PM
How do I move all items in a listbox to another listbox kent ASP .Net 1 05-03-2004 12:17 AM
click listbox and refresh another listbox DC Gringo ASP .Net 0 04-06-2004 02:13 AM



Advertisments