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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T06:07:26+00:00 2026-06-14T06:07:26+00:00

I have a MVC 2 / jQuery mobile application. On my main view I

  • 0

I have a MVC 2 / jQuery mobile application.

On my main view I have a list that is sortable. The sort works by url parameter sortorder. the dropdown with which you can change the sorting is in a partial view that looks like this:

<div class="ui-select">
    <select name="sortSelect" id="sortSelect" data-mini="true">
        <option value="opt1">Option 1</option>
        <option value="opt2">Option 2</option>
        <option value="opt3">Option 3</option>
    </select>
</div>

Then I have a jQuery that checks whether the dropdown is changed. On change it adds or changes url sort parameter with new dropdown value and redirects to new url:

$(document).ready(function () {
    $('#sortSelect').change(function () {
        var sortOrder = $('#sortSelect').val();
        var url = document.URL;
        if (url.indexOf("sortorder=") > -1)
            url = url.replace(/sortorder=[^&]+/, "sortorder=" + sortOrder);
        else
            url = url + "&sortorder=" + sortOrder;
        window.location.replace(url);
    });
});

As there are a few other parameters before the sortorder it is ok that is added with &.

To set the correct value from the url when the page is newly loaded I have following jQuery (function gup reads value from url):

$('#sortSelect').ready(function () {
    var sortorder = gup('sortorder');
    if (sortorder != '')
        $('#sortSelect').val(sortorder);
}

There is the problem: if I load the site and change the sortorder by dropdown, everything works so far. The page is newly loaded with new url parameter and newly sorted list. even the dropdown value is set correctly (I checked this by alert($('#sortSelect').val(), but the dropdown text is the old one. If I press F5 the site refreshes, and the dropdown has its correct text…

Any ideas how i can solve the problem? Or what is the problem at all?

  • 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-06-14T06:07:27+00:00Added an answer on June 14, 2026 at 6:07 am

    I found the answer on my own. As expected I have to refresh the select (dropdown) with $("#sortSelect").selectmenu("refresh"); like this:

    $('#sortSelect').ready(function () { 
        var sortorder = gup('sortorder'); 
        if (sortorder != '') $('#sortSelect').val(unescape(sortorder));
        $("#sortSelect").selectmenu("refresh");
    }); 
    

    sometimes, easy problems take some time 😉

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

Sidebar

Related Questions

I have a dynamic MVC4, jQuery Mobile application that works for the most part
I have an MVC view that contains a JQuery UI dialog that can be
I have an asp.net mvc 4 with jquery-mobile app. On one page (url: /StatementBatch
I have a MVC beginform (with JQUERY UI MOBILE AND AJAX.) When the user
I have a MVC app and using JQuery. I have anchor that I setup
I have an MVC app that does a lot of work with jQuery ajax
I have a jquery routine that calls an MVC action which will do a
I have an ASP.NET MVC view on which I've placed jQuery tabs. I'm loading
I am using ASP.NET MVC with jQuery. I have the following MVC Action that
I have a MVC application with Jquery; I have a gridview with some data

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.