title: Begin.Form with overload that accepts routeValues and htmlAttributes
body: <p>I use an overload of Begin.Form that accepts routeValues</p>
  
  <pre><code>    &lt;% 
          RouteValueDictionary routeValues = ViewContext.RouteData.Values;
          routeValues.Add("TestRoute1", "test");
  
          using (Html.BeginForm(
              "Category", 
              "Home",
                routeValues,
                FormMethod.Post
  
        ))
         { %&gt;  
  
          &lt;input type="submit" value="submit" name="subform" /&gt;
  &lt;% }%&gt;
  </code></pre>
  
  <p>This works nice and renders the formtag as:</p>
  
  <pre><code>&lt;form method="post" action="/Home/Category?TestRoute1=test"&gt;
  </code></pre>
  
  <p>I need to change htmlAttributes, thats why I  used:</p>
  
  <pre><code>    &lt;% 
          RouteValueDictionary routeValues = ViewContext.RouteData.Values;
          routeValues.Add("TestRoute1", "test");
  
          using (Html.BeginForm(
              "Category", 
              "Home",
                routeValues,
                FormMethod.Post,
                new {id="frmCategory"}
  
        ))
         { %&gt;  
  
          &lt;input type="submit" value="submit" name="subform" /&gt;
  &lt;% }%&gt;
  </code></pre>
  
  <p>The result is completely wrong:</p>
  
  <pre><code>&lt;form method="post" id="frmTyreBySizeCar" action="/de/TyreSize.mvc/List?Count=12&amp;amp;Keys=System.Collections.Generic.Dictionary%....
  </code></pre>
  
  <p>I can see in the source of the Formhelper what the reason is.</p>
  
  <p>There are 2 overloads that apply to my given parameters:</p>
  
  <pre><code>public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, object routeValues, FormMethod method, object htmlAttributes)
  
  public static MvcForm BeginForm(this HtmlHelper htmlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, FormMethod method, IDictionary&lt;string, object&gt; htmlAttributes)
  </code></pre>
  
  <p>It goes wrong, because the first method is picked up. If I dont supply htmlAttributes, then there is no overload with object as a parameter and everyrthing works as expected.</p>
  
  <p>I need a workaround that accepts a Dictionary of RouteValues and htmlAttributes. I see that there are overloads that have an additional routeName, but thats not what I want.</p>
  
  <p>EDIT: eugene showed the right usage of BeginForm.</p>
  
  <pre><code>Html.BeginForm("Category", "Home",
  new RouteValueDictionary { {"TestRoute1", "test"} },
  FormMethod.Post,
  new Dictionary&lt;string, object&gt; { {"id", "frmCategory"} }
  </code></pre>
  
  <p>)</p>