title: ASP.NET MVC, Querystring, routes and default binder, how do I combine this?
body: <p>I have an ASP.NET MVC site that uses strongly typed views. In my case, a controller action could look like this:</p>
  
  <pre><code>public ActionResult List(MyStrongType data)
  </code></pre>
  
  <p>When submitting the page (view) the response will generate a URL that looks something like this (yes, I know routing could generate a nicer URL): </p>
  
  <pre><code>http://localhost/Ad/List?F.ShowF=0&amp;ALS.CP=30&amp;ALS.L=0&amp;ALS.OB=0&amp;ALS.ST=0&amp;S=&amp;LS.L1=&amp;LS.L2=&amp;CS.C1=32&amp;CS.C2=34&amp;CS.C3=&amp;ALS.ST=0
  </code></pre>
  
  <p>If I submit the page again, I can see that the data object in the action is set properly (according to the URL)(default binder).</p>
  
  <p>The problem is: Say that I am to add page buttons (to change the page) for a list on my sitepage, the list will be controlled by settings like filter, sortorder, amount of pages per page and so on (controlled by the querystring). First, I need to include all current query parameters in the URL, and then I need to update the page parameter without tampering with the other query parameters. How can I genereate this URL from the view/"HTML helper"?</p>
  
  <p>I could of course manipulate the URL string manually, but this will involve a lot of work and it will be hard to keep up to date if a route is changed, there must be a easier way? Like some kind of querystring collection that can be altered on service side (like ASP.NET Request.QueryString)?</p>
  
  <p>I would hope to not involve the route, but I post the one I got so far anyway:</p>
  
  <pre><code>    routes.MapRoute(
          "Default",
          "{controller}/{action}/{id}",
          new { controller = "Home", action = "Index", id = UrlParameter.Optional }
      );
  
      routes.MapRoute(
          "TreeEditing",
          "{controller}/{action}/{name}/{id}",
          new { controller = "MyCategory", action = "Add", name = string.Empty, id = -1 }
      );
  </code></pre>
  
  <p><strong>BestRegards</strong></p>
  
  <p>Edit 1: It's possible to set the query parameters like this (in view):</p>
  
  <pre><code>&lt;%= url.Action(new {controller="search", action="result", query="Beverages", Page=2})%&gt;
  </code></pre>
  
  <p>But this will only generate a URL like this (with the default route):</p>
  
  <pre><code>/search/result?query=Beverages&amp;page=2
  </code></pre>
  
  <p>The rest of the parameters will be missing as you can see.</p>
  
  <p>I could of course add every known parameter in this <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" rel="nofollow">URL</a> action, but if any query parameter is added or changed there will be a lot of work to keep everything up to date.</p>
  
  <p>I have read the article <em><a href="http://aspalliance.com/1525_ASPNET_MVC_Framework_Part_2_URL_Routing.all" rel="nofollow">ASP.NET MVC Framework (Part 2): URL Routing</a></em>, but how do I find an answer to my problem?</p>