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

  • Home
  • SEARCH
  • 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 7627529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:28:19+00:00 2026-05-31T05:28:19+00:00

I am implementing this JQuery UI multiselect from http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/ I have managed to get

  • 0

I am implementing this JQuery UI multiselect from
http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/

I have managed to get it to use in my asp.net page, but for some reason after postback, the selected text shows only the last element checked.

Here is my Code

$("document").ready(function () {

    $("#ListBox1").multiselect({

        noneSelectedText: 'Select',
        selectedList: 200

    });

    $("#ListBox2").multiselect({

        noneSelectedText: 'Select',
        selectedList: 200

    });

    function GetSelectedListBox() {


    var array_of_checked_values = $("#ListBox1").multiselect("getChecked").map(function () {
        return this.value;
    }).get();

    var array_of_checked_values1 = $("#ListBox2").multiselect("getChecked").map(function () {
        return this.value;
    }).get();

    $("#HiddenField1").val(array_of_checked_values);

    $("#HiddenField2").val(array_of_checked_values1);


}

});


<body>
    <form id="form1" runat="server">
    <div style="font:12px Helvetica, arial, sans-serif;">
        <asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
        <asp:ListBox ID="ListBox2" runat="server"></asp:ListBox>
        <asp:HiddenField ID="HiddenField1" runat="server" />
        <asp:HiddenField ID="HiddenField2" runat="server" />
    </div>
    <div>
        <asp:Button ID="btn1" runat="server" Text="Press"  OnClientClick="GetSelectedListBox();" onclick="btn1_Click" />
    </div>
    </form>
</body>

in my server side code

ListBox2.DataSource = dt;
ListBox2.DataTextField = "Id";
ListBox2.DataValueField = "ListValue";
ListBox2.DataBind();

protected void btn1_Click(object sender, EventArgs e)
{
    Response.Write(HiddenField1.Value);

    Response.Write(HiddenField2.Value);
}

Any ideas why is it showing only last selected element but the interesting this the values in the HiddenField is displaying “Value1,Value2,Value3, value21” whereas the widget box is only showing value21, and only value21 is disaplyed as checked in the widget when all the elements where checked prior to postback

Thanks

  • 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-31T05:28:20+00:00Added an answer on May 31, 2026 at 5:28 am

    I was actually just having that same problem.

    Try using a listbox with the selection mode as Multiple, I have a postback in my page and the values stay there

    <asp:ListBox ID="ListBox1" SelectionMode="Multiple" runat="server"></asp:ListBox>
    

    also, there doesn’t seem to be a SelectedItem*s* for a listbox in asp.net only on forms so you need to do this manually something like this

    private String GetSelectedItems(ListBox listbox)
    {
        String SelectedValues = "";
    
        foreach ( ListItem item in listbox.Items)
        {
            if(item.Selected == true)
                SelectedValues = SelectedValues + "," + item.Text ;
        }
    
        if (SelectedValues.Length > 1)
            SelectedValues = SelectedValues.Remove(0, 1);
    
        return SelectedValues;
    }
    

    This works for me values stay after each post back and I can access the list of selected values in code behing 🙂 , let me know if it helps you

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

Sidebar

Related Questions

I'm following this tutorial here: http://brenelz.com/blog/implementing-paging-using-php-and-jquery/ Here is what I have: http://eataustineat.com/testingfolder/ I've encountered
I'm implementing this JQuery Lightbox plugin inside a DataList: http://leandrovieira.com/projects/jquery/lightbox/ I tested this code
I have this jQuery plugin called Easy Slider which I'm implementing on this site
I have seen this link: Implementing Mutual Exclusion in JavaScript . On the other
I have this question: Does implementing a custom MembershipProvider class needs you to implement
I'm having trouble implementing this jQuery plugin for dynamic forms while following this tutorial
I am implementing a portlet/widget JQuery interface using Interface and JQuery. The user drags
How use partial decorator in Jquery Element I use this code for Form Element:
I am a novice at implementing jQuery add ons. I'd like to use editable
I am implementing the Jquery UI autocomplete. I have the following code. Application.js $(function()

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.