How to move items from one listbox to another on a client side?

Discussion in 'ASP .Net' started by bogdan, Apr 28, 2008.

  1. bogdan

    bogdan Guest

    Hi,

    I have two listboxes on a page and need to move items between them - using
    buttons (e.g. "<<" ">>"). Can this be done on a client side in asp.net?
    I'd like to avoid hitting the server on every add/remove.

    Thanks,
    Bogdan
    bogdan, Apr 28, 2008
    #1
    1. Advertising

  2. You can move them using JavaScript, if you wish. You will still have to take
    a server trip to commit back to the database, however. A simple example is
    here (will not vouch for code, however):

    http://www.codeproject.com/KB/aspnet/Listbox_or_combo_box.aspx

    --
    Gregory A. Beamer
    MVP, MCP: +I, SE, SD, DBA

    Subscribe to my blog
    http://gregorybeamer.spaces.live.com/lists/feed.rss

    or just read it:
    http://gregorybeamer.spaces.live.com/

    *************************************************
    | Think outside the box!
    |
    *************************************************
    "bogdan" <> wrote in message
    news:...
    > Hi,
    >
    > I have two listboxes on a page and need to move items between them - using
    > buttons (e.g. "<<" ">>"). Can this be done on a client side in asp.net?
    > I'd like to avoid hitting the server on every add/remove.
    >
    > Thanks,
    > Bogdan
    >
    >
    Cowboy \(Gregory A. Beamer\), Apr 28, 2008
    #2
    1. Advertising

  3. bogdan

    bogdan Guest

    Thanks for the reply. Since I'm rather new to asp.net I think I
    miscalculated what I could do on the client side. I have the code working
    moving items between listboxes but have no clue how to pass items of one of
    the listboxes back to the server. I could put a 'Save' button that would
    post back to the server but I don't know how to pass the new set of items in
    the listbox. The old ones are in the viewstate. Is there a way to do that?
    I might try to select all items on the client side before posting back but
    I'm afraid that this might not work because of discrepancies between old
    items and selected ones (e.g. selected items were not present in the list
    when it was sent to the client).

    Any help would be appreciated.

    Thanks,
    Bogdan


    "Cowboy (Gregory A. Beamer)" <> wrote in
    message news:...
    > You can move them using JavaScript, if you wish. You will still have to
    > take a server trip to commit back to the database, however. A simple
    > example is here (will not vouch for code, however):
    >
    > http://www.codeproject.com/KB/aspnet/Listbox_or_combo_box.aspx
    >
    > --
    > Gregory A. Beamer
    > MVP, MCP: +I, SE, SD, DBA
    >
    > Subscribe to my blog
    > http://gregorybeamer.spaces.live.com/lists/feed.rss
    >
    > or just read it:
    > http://gregorybeamer.spaces.live.com/
    >
    > *************************************************
    > | Think outside the box! |
    > *************************************************
    > "bogdan" <> wrote in message
    > news:...
    >> Hi,
    >>
    >> I have two listboxes on a page and need to move items between them -
    >> using buttons (e.g. "<<" ">>"). Can this be done on a client side in
    >> asp.net? I'd like to avoid hitting the server on every add/remove.
    >>
    >> Thanks,
    >> Bogdan
    >>
    >>

    >
    >
    bogdan, Apr 28, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kent
    Replies:
    1
    Views:
    861
    Andrew de la Harpe
    May 3, 2004
  2. Valerian John
    Replies:
    6
    Views:
    5,032
    Valerian John
    May 17, 2004
  3. Partha Sarathy.G
    Replies:
    1
    Views:
    1,364
    =?Utf-8?B?cHJhZGVlcA==?=
    Feb 9, 2006
  4. K B
    Replies:
    2
    Views:
    653
  5. mc
    Replies:
    0
    Views:
    218
Loading...

Share This Page