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 6535221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:20:52+00:00 2026-05-25T10:20:52+00:00

I have 2 list boxes which exchange items between them. I am doing this

  • 0

I have 2 list boxes which exchange items between them. I am doing this using javascript.
Im adding the items of the first listbox from the view. If I want to bind it from the model, what should I do? I have these properties in my model

    public List<ICode> UnAssignedStates { get; set; }
    public List<ICode> AssignedStates { get; set; }

where ICode is as below

    public interface ICode
{
    int Id { get; set; }
    ICodeGroup CodeGroup { get; set; }
    string ShortDescription { get; set; }
    string LongDescription { get; set; }
}

My view is as below

<table style="width:90%;  text-align:center">
        <thead>
            <tr>
                <th>Unassigned State:</th>
                <th></th>
                <th>Assigned State:</th>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td valign="top">
                    <select id="box1View" multiple="multiple" style="height:100px;width:250px;">
                        <option value="501649">Item1</option>
                        <option value="501497">Item2</option>
                        <option value="501053">Item3</option>
                        <option value="500001">Item4</option>
                        <option value="501227">Item5</option>
                        <option value="501610">Item6</option>
                    </select><br/>
                     <span id="box1Counter" class="countLabel"></span>
                   <select id="box1Storage">
                    </select>
                </td>
                <td valign="top">
                <button style=" color:White; height:22px; width:50px; background-image: url('@Url.Content("~/Content/Images/BlueButton.gif")');" id="to2" type="button">&nbsp;>&nbsp;</button><br />
                <button style=" color:White; height:22px; width:50px; background-image: url('@Url.Content("~/Content/Images/BlueButton.gif")');" id="allTo2" type="button">&nbsp;>>&nbsp;</button><br />

                <button style=" color:White; height:22px; width:50px; background-image: url('@Url.Content("~/Content/Images/BlueButton.gif")');" id="allTo1" type="button">&nbsp;<<&nbsp;</button><br />
                <button style=" color:White; height:22px; width:50px; background-image: url('@Url.Content("~/Content/Images/BlueButton.gif")');" id="to1" type="button">&nbsp;<&nbsp;</button>
                </td>
                <td valign="top">
                <select id="box2View" multiple="multiple" style="height:100px;width:250px;">

                </select><br/>
                <span id="box2Counter" class="countLabel"></span>
                <select id="box2Storage">
                </select>
                </td>
            </tr>
        </tbody>
      </table>
  • 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-25T10:20:53+00:00Added an answer on May 25, 2026 at 10:20 am

    Assuming you are using Razor for your view engine replace the following

    <select id="box1View" multiple="multiple" style="height:100px;width:250px;">
                            <option value="501649">Item1</option>
                            <option value="501497">Item2</option>
                            <option value="501053">Item3</option>
                            <option value="500001">Item4</option>
                            <option value="501227">Item5</option>
                            <option value="501610">Item6</option>
    </select>
    

    with:

    @Html.ListBox("box1View", new SelectList(Model.UnAssignedStates, "Id", "ShortDescription"), new {style = "height:100px;width:250px;"})
    

    and replace

    <select id="box2View" multiple="multiple" style="height:100px;width:250px;"></select>
    

    with:

    @Html.ListBox("box2View", new SelectList(Model.AssignedStates, "Id", "ShortDescription"), new {style = "height:100px;width:250px;"})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list of say, 20 items. Each of them are boxes in
I have a partial view which has dual list boxes and four buttons; exactly
I have a listbox that has a datatemplate which contains multiple text boxes. I
I have to load a div with a list of check boxes using ajax.
If I have Checked list box in Win forms which I fill like this
I have a simple web form which has a couple list boxes and a
I have an instance of System.Windows.Forms.CheckedListBox which displays a list of tick boxes and
I have a list of check boxes. For the check boxes that are selected,
I have a list of file input boxes and I want to know if
I have a simple list view with some check boxes in an alert dialog.

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.