Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6748741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:36:06+00:00 2026-05-26T12:36:06+00:00

I have a javascript function below to move from select multiple box A which

  • 0

I have a javascript function below to move from select multiple box A which is populated from database to another multiple select box B, in the event of a postback my values in B which are moved over from A got lost. Initially I thought because I included a “runat=”server”” tag for server side actions but apparently it’s not the case. I read about Form.Request but ain’t have a clue how to go about it. I just need to retain those values in multiple select box B. Please kindly advice. Thanks.

<%– Move items to and fro select box –%>

function move(sourceFrom, sourceTo) {
    var arrFrom = new Array();
    var arrTo = new Array();
    var arrLU = new Array();
    var i;
    for (i = 0; i < sourceTo.options.length; i++) {
        arrLU[sourceTo.options[i].text] = sourceTo.options[i].value;
        arrTo[i] = sourceTo.options[i].text;
    }
    var fLength = 0;
    var tLength = arrTo.length;
    for (i = 0; i < sourceFrom.options.length; i++) {
        arrLU[sourceFrom.options[i].text] = sourceFrom.options[i].value;
        if (sourceFrom.options[i].selected && sourceFrom.options[i].value != "") {
            arrTo[tLength] = sourceFrom.options[i].text;
            tLength++;
        } else {
            arrFrom[fLength] = sourceFrom.options[i].text;
            fLength++;
        }
    }

    sourceFrom.length = 0;
    sourceTo.length = 0;

    var ii;
    for (ii = 0; ii < arrFrom.length; ii++) {
        var no = new Option();
        no.value = arrLU[arrFrom[ii]];
        no.text = arrFrom[ii];
        sourceFrom[ii] = no;
    }

    for (ii = 0; ii < arrTo.length; ii++) {
        var no = new Option();
        no.value = arrLU[arrTo[ii]];
        no.text = arrTo[ii];
        sourceTo[ii] = no;
    }

    (sourceTo).focus();

    if (sourceTo == (document.getElementById('<%= outletFromBox.ClientID%>'))) {
        (sourceFrom).focus();
    }
    if (sourceTo == (document.getElementById('<%= QualMemTypeFromBox.ClientID %>'))) {
        (sourceFrom).focus();
    }
    if (sourceTo == (document.getElementById('MemStatusFromBox'))) {
        (sourceFrom).focus();
    }
}  
<select multiple size="8" style="width: 135px" runat="server" onblur="selectAll(this, true, document.getElementById('<%#uilblDestinationQualOutlet.ClientID%>'))"
                                        id="outletToBox">
                                    </select>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:36:07+00:00Added an answer on May 26, 2026 at 12:36 pm

    Client-side changes to a ListBox are not persisted server-side, so any changes made will be lost if a PostBack occurs; check out this link to see how you can handle it:

    http://www.vijaykodali.com/Blog/post/2007/12/14/Add-Delete-Items-in-DropDownList2c-ListBox-using-Javascript.aspx

    If you’re having trouble working with that solution let me know, and post your aspx page code…we can put together a solution for your exact case.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a JavaScript function named move which does just windows.location.href = any given
I have javascript which sets the location of panel and javascript is below function
I am calling a javascript function from .cs file which is as below: private
I have a Javascript function for my select box, but after I included runat=server
I have a JavaScript function, pop_item . I have to call this from PHP,
i have javascript as below html=<th>+<?php echo __(); ?>+</th>; I want to add another
Framework: Javascript, Jqgrid I have the below javascript function. It receives array of fields
I have a page with a dropdown. The onchange event calls a Javascript function
I have the working code pasted below which has a function called FormatStatus() as
I have javascript code like below - function initPage(){ // Left Navigation Pane -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.