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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:21:41+00:00 2026-05-18T12:21:41+00:00

I’m working with ASP.NET MVC 2 and building a simple business app. Here are

  • 0

I’m working with ASP.NET MVC 2 and building a simple business app. Here are some of the details:

  • The app deals with work orders and
    has a work order index view. The
    view has a table listing the work
    orders, and several controls (text
    boxes, check boxes, and drop down
    lists) to select the criteria for
    which work orders to display.

  • I’m using viewmodels. The work order
    index view has a viewmodel with
    properties for each and every
    control.

  • I’ve implemented paging similar to
    what is being done in the answer to
    this question:
    How do I do pagination in ASP.NET MVC?
    I’m using LINQ’s Skip() and Take() as
    demonstrated, and ActionLinks for the
    navigation.

  • If I load the page and don’t
    manipulate any of the controls, I can
    click on the page number ActionLinks
    and move around just fine between
    pages of work orders. However, if I
    change something, my changes are lost
    when I navigate to another page.

    For example, if I’m on page 1 and
    click an unchecked check box, and
    then click on the link for page 2,
    the second page of results will load
    but the check box will revert to its
    previous state.

I understand why this happens, but I’m wondering what is the best thing to do from a design standpoint.

Potential solutions I can think of:

  1. Set all the control values as route
    values in the ActionLinks. This
    seems really nasty, and could result
    in very long URLs or query strings.
    Actually, now that I think of it this wouldn’t work without a way to capture the control values.

  2. Since ActionLinks don’t post
    anything, replace them with buttons.
    Again, this seems like a bad idea.

  3. Change the ActionLinks to links that
    fire off a jQuery script that does a
    POST. I think this is the most
    promising option so far. Do many
    developers do it this way?

This seems like a common enough problem, but none of these options feel quite right. I wonder if I’m missing something.

  • 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-18T12:21:41+00:00Added an answer on May 18, 2026 at 12:21 pm

    In the end, I wound up getting rid of the ActionLinks for the paging, and replaced them with regular anchor tags. The current page index is now stored in a hidden form value:

    <input id="page" name="page" type="hidden" value="" />
    
    <p>
        <% for (var i = 1; i <= (int)Math.Ceiling(Model.RowsMatchingCriteria / (double)Model.PageSize); i++) { %>
    
            <%--
                If the page number link being rendered is the current page, don't add the href attribute.
                That makes the link non-clickable.
            --%>
            <a class="pageLink" <%= i != Model.Page ? @"href=""javascript:void(0);""" : string.Empty %>><%: i %></a>
    
        <% } %>
    </p>
    

    Then I added the following jQuery script, which sets the hidden page value and submits the form when a link is clicked:

    $(document).ready(function () {
    
        $('.pageLink:[href]').click(function () {
            $('#page').val($(this).text());  // Set hidden field value to the text of the page link, which is the page number.
            $('form:first').submit();
        });
    
    });
    

    Problem solved.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
We're building an app, our first using Rails 3, and we're having to build
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

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.