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

The Archive Base Latest Questions

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

I have the following scenario: 1) A phone book table 2) Multiple ways of

  • 0

I have the following scenario:

1) A phone book table

2) Multiple ways of searching through the table (first name, last name)

3) There is also the obligatory paging (page size and page number) as well as sorting

When the user accesses the page first the Url is simply /Phonebook. Now let’s say the user is searching for “abc”, then the Url becomes /Phonebook?q=abc. Then he is sorting ascending by first name, and the Url should become /Phonebook?q=abc&sort=firstName&order=asc.

The problem I have is how do I program my view to automatically append/modify the query string so that it still contains previously entered constraints (as in my “abc”) query but adjusts/adds new constraints for example if sorting, and then paging etc. is used?

I’d hate to use JS and rewriting the location for this, and rather have the page generate real anchors (a href) after every postback for each sort/page/filter link on my page.

Appreciate your time folks 🙂

  • 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-12T05:19:18+00:00Added an answer on May 12, 2026 at 5:19 am

    I assume you have some sort of controls on the page to set what will be sorted, in what order and obviously a way to define what will filtered?

    When you load the page, why not set those values in the view and then the controller should update correctly on the next load? That way it is easy for the user to change them as well without needing to touch the URL. In this case it is straight forward passing the data from the controller to the view and setting the values as you would any other control, for instance:

    <input type="text" name="search" value="<%= (string)ViewData["Search"] %>" />
    

    If you really need it in the URL, you can modify the button by passing the extra parameters in an anonymous type.

    For a link something like this:

    <%= Url.Action("Search", "PhoneBook", new {order="asc"}) %>
    

    For a form (since you don’t specifically set a submit button) something like this

    <% using (Html.BeginForm(new {order="asc"}) { 
    

    You could pull those from the controller by doing something like

    <% using (Html.BeginForm(new { sort=(string)ViewData["Sort Order"] }))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following scenario in nHibernate: <class name=TestApp.Components.User,TestApp.Components table=Users> <id name=Id column=UserId type=Int32
I have the following scenario. I have a combobox where multiple selection is available.
I have the following scenario: <xsl:variable name=var1 select='SOME_DATA1' /> <xsl:if test='some_condition'> <xsl:variable name=var2 >
In a Windows Phone project I have the following scenario: The user types some
I have the following scenario 1- A combobox in xaml <ComboBox x:Name=PublishableCbo Width=150 IsEnabled=True
I have the following scenario: A Doctor can have multiple Companions . A Companion
I have the following scenario First I get the total rows in my html
I have the following scenario. I have one table in the database A that
I have the following scenario to implement: there is the product registration, but this
I have the following scenario, using mvc3: I have a database table which holds

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.