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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:48:48+00:00 2026-05-16T22:48:48+00:00

I have a route that looks like this: new { controller = ControllerName, action

  • 0

I have a route that looks like this:

new { controller = "ControllerName", action = "PhotoGallery", slug = "photo-gallery", filtertype = UrlParameter.Optional, filtervalue = UrlParameter.Optional, sku = UrlParameter.Optional}

and I have a form that looks like this:

  <%using(Html.BeginForm("PhotoGallery", "ControllerName", FormMethod.Get)) {%>
  <%:Html.Hidden("filtertype", "1")%>
  <%:Html.DropDownList("filtervalue", ViewData["Designers"] as SelectList, "Photos by designer", new { onchange = "selectJump(this)" })%>
  <%}%>

Right now when the form is submitted I get the form values appended to the url as query strings (?filtertype=1 etc) Is there a way to get this form to use routing to render the URL?

So the form would post a URL that looked like this:

www.site.com/photo-gallery/1/selectedvalue

and not like”

www.site.com/photo-gallery?filtertype=1&filtervalue=selectedvalue

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-16T22:48:48+00:00Added an answer on May 16, 2026 at 10:48 pm

    If you only have some of the parameters present, Mvc will create a Query String type Url unless it finds an exact matching url.

    Suggest you will need something like:

    routes.Add("testRoute", 
    new Route("/{action}/{controller}/{slug}/{filtertype}/{filtervalue}",
    new { controller = "ControllerName", action = "PhotoGallery", slug = "photo-gallery", filtertype = UrlParameter.Optional, filtervalue = UrlParameter.Optional}
    );
    

    make sure this is before your existing route

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

Sidebar

Related Questions

I have a route in my asp.net mvc 2 site that looks like this
I have a route that I am calling through a RedirectToRoute like this: return
I have the following route defined routes.MapRoute( ItemName, {controller}/{action}/{projectName}/{name}, new { controller = Home,
Having this route: map.foo 'foo/*path', :controller => 'foo', :action => 'index' I have the
I have an asp.net mvc application with a route similar to: routes.MapRoute(Blog, {controller}/{action}/{year}/{month}/{day}/{friendlyName}, new
Let's say I have defined a route: routes.Add(new Route(Users/{id}, new MvcRouteHandler()) { Defaults =
In my routing I would like to have something like not found route handler.
I have the following in my Global.asax.cs routes.MapRoute( Arrival, {partnerID}, new { controller =
I am trying to create an action ( :my_action ) route that will allow
Hei guys i have this JQuery Ajax call from my view and it looks

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.