title: Passing additional parameters with a form submission to a controller with ASP.NET MVC 4
body: <p>I have an Edit view that allows my user to update the technical information about a vehicle. When the edit is carried out I want to pass a Customer Number and a Vehicle Number to the controller so that I can make an audit log entry against the customer and vehicle to record the changes.</p>
  
  <p>I have this code in my controller:</p>
  
  <p>GET:</p>
  
  <pre><code>public ActionResult Edit(int id, int? AuditLogID, int? ErrorLogID, int CustomerNo, int VehicleNo)
  </code></pre>
  
  <p>POST:</p>
  
  <pre><code>public ActionResult Edit(int id, VehicleAssetTechnicalInformation technicalInformation, int CustomerNo, int VehicleNo)
  </code></pre>
  
  <p>The CustomerNo and VehicleNo should be required - an update should not be able to proceed without these details as everything must be audited.</p>
  
  <p>In my Edit.cshtml view I have this:</p>
  
  <pre><code>@using (Html.BeginForm("Edit", 
      "VehicleAssetTechnicalInformation", 
      FormMethod.Post, 
      new { CustomerNo = (int)ViewBag.CompanyID, 
          VehicleNo = (int)ViewBag.VehicleID }))
  </code></pre>
  
  <p>Inside my View I even show the ViewBag.CompanyID and ViewBag.VehicleID to the user so I know they exist when the view is loaded.</p>
  
  <p>However, when I submit the form I get the following:</p>
  
  <pre><code>The parameters dictionary contains a null entry for parameter 'CustomerNo' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult Edit(Int32, VehicleAssetTechnicalInformation, Int32, Int32)
  </code></pre>
  
  <p>For some reason the CustomerNo and VehicleNo are not being submitted as attributes with the form.</p>
  
  <p>What can I do to make sure these values are passed along?</p>