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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:11:56+00:00 2026-06-11T15:11:56+00:00

I have a search forms with pages that return a calendar. In top I

  • 0

I have a search forms with pages that return a calendar. In top I have some search criteria and it all works fine if it’s only one value but not if it’s a list. When I want to build the url for the next month in my model I have something like this :

public ActionResult GetUrl()
    {
        var action = GetBaseAction();
        if (SelectedDivisions.Any()) action.AddRouteValue("SelectedDisions", SelectedDivisions.ToArray());
        if (RoomId.HasValue) action.AddRouteValue("RoomId", RoomId.Value);
        if (TeacherId.HasValue) action.AddRouteValue("TeacherId", TeacherId.Value);
        if (Month.HasValue) action.AddRouteValue("Month", Month.Value);
        if (Year.HasValue) action.AddRouteValue("Year", Year.Value);
        if (Day.HasValue) action.AddRouteValue("Day", Day.Value);

        return action;
    }

Wich add the parameters to the next month URL :

http://afi.local/coursesession/calendar?Month=9&Year=2012&Day=18&ViewType=weekly

but since you can select more than one division, it’s a list of checkbox so when I post my form, I get this URL :

http://afi.local/coursesession/calendar?Month=9&Year=2012&Day=18&ViewType=weekly&SelectedDivisions=1&SelectedDivisions=2

The problem is that if I add 2 times the same keys it throw an exception and I don’t know how to rebuild my URL with more than one division in the query string.

Thanks for the help!

  • 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-11T15:11:58+00:00Added an answer on June 11, 2026 at 3:11 pm

    I found a solution here : https://stackoverflow.com/a/717732/245836

    Basicly what I do is this :

    var routeValues = new RouteValueDictionary();
                for (var i = 0; i < SelectedDivisions.Count; i++)
                {
                    routeValues["SelectedDivisions[" + i + "]"] = SelectedDivisions[i];
                }
                action.AddRouteValues(routeValues);
    

    And the resulting URL is not very clean but the bindings works fine :

    http://afi.local/coursesession/calendar?SelectedDivisions%5B0%5D=1&SelectedDivisions%5B1%5D=2&SelectedDivisions%5B2%5D=3&Month=9&Year=2012&Day=11&ViewType=weekly

    So now I can copy paste that URL and it will work for any search in my calendar.

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

Sidebar

Related Questions

what I have: a google search form (displayed on all pages) a wordpress page
In one page I have two form for search: <form class=search-panel method=post action= onsubmit=return
So we have a variety of search pages each with different search criteria, so
I have a search form on my site that submits the url in the
(Using MySQL and PHP) I have a search form that will allow my users
On my homepage I have a simple search form. The user can enter some
Basically I have an asp.net website with login and search pages. Currently, I have
I have a search form that can search in different provider. I started out
I have a search that returns an AJAX(MVC AJAX Form) grid, and, in the
Hey guys, I have a search field that is not submitting when the enter

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.