title: I can't get the @ActionLink to render the correct url to work with my MVC3 default routing
body: <p>I'm trying to take advantage of the default routing so I get a URL without a query string parameter.</p>
  
  <p>So, I've currently got this url:</p>
  
  <pre><code> http://www.mysite.Items/Edit?ItemID=19719
  </code></pre>
  
  <p>And I'm trying to get a URL like this:</p>
  
  <pre><code> http://www.mysite.Items/Edit/19719
  </code></pre>
  
  <p>The routing works, but I can't get the @Html.ActionLink method to produce the 2nd url.</p>
  
  <p>Here is my razor code:</p>
  
  <pre><code> @Html.ActionLink("Edit", "Edit", new {item.ItemID}, new { id = "edit-" + item.ItemID })
  </code></pre>
  
  <p>The first argument is my link's text. The 2nd argument is the Action. 3rd is the ID Value and finally the last argument is and HTML attribute I use for some javascript I'm using.</p>
  
  <p>Originally I had my 3rd Argument as </p>
  
  <pre><code>  new {itemID = itemID}
  </code></pre>
  
  <p>This was when my Edit action expected an integer value named itemID as the parameter. I changed it to 'id' so the routing would work.</p>
  
  <p>Ideally I would like a route that would pass the 19719 value to an action with the argument named itemID, but this is beyond the scope of this question.</p>
  
  <p>Thanks in advance.</p>
  
  <p><strong>SOLVED</strong>
  Thanks <a href="https://stackoverflow.com/users/29407/darin-dimitrov">Darin Dimitrov</a> for this solution.</p>
  
  <p>I ended up leaving my html code and action arguments the way I had them originally.  All that was really required was an update to my routes.  I should note that I had to add my new route map before the default.  Anyway, here is my route registration now that made this all work.</p>
  
  <pre><code>  public static void RegisterRoutes(RouteCollection routes) {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
          routes.MapRoute("", "Items/{action}/{itemID}", new { controller = "Items", action = "Details", itemID = @"\d+" });
          routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } );           
      }
  </code></pre>