title: Pass @Html.DropDownList selection using @Html.ActionLink with ViewModel to Controller
body: <p>I've been reading through posts for two days regarding this, and still have not figured out the answer. I want to capture the DropDownList selection within my ModelView, pass this to a @Html.ActionLink, which will send it back to a specific Action within the Controller.</p>
  
  <p>My ViewModel:</p>
  
  <pre class="lang-html prettyprint-override"><code>    public class ViewModelShipments
      {
          public ViewModelShipments()
          {
              tblShipments = new tblShipments();
          }
          public tblShipments tblShipments;
          public IEnumerable&lt;SelectListItem&gt; ShipmentIDsList;
          public string SelectedShipmentID; 
      }
  </code></pre>
  
  <p>My Controller:</p>
  
  <pre class="lang-html prettyprint-override"><code>public ActionResult SelShipment(string SelectedShipmentID)//for ShipmentID change via DropDownList
          {
              int id = db.tblShipments.Max(p =&gt; p.ShipmentID); // find last ShipmentID
              if (SelectedShipmentID != null)
              {
                  id = Int32.Parse(SelectedShipmentID);//convert text to int
              }
  </code></pre>
  
  <p>My View:</p>
  
  <pre><code>            @Html.DropDownListFor(expression: model=&gt;model.SelectedShipmentID,selectList: Model.ShipmentIDsList) @* render DropDownList object*@
              @Model.SelectedShipmentID @* display value of SelectedShipmentID *@
  
              &lt;!-- Upon Click, send selected ID to controller --&gt; 
              &lt;!-- the ActionLink is working, but the routeValues: always contain NULL --&gt;
              @Html.ActionLink(linkText: "Submit", actionName: "SelShipment", controllerName: "Shipment", routeValues: Model.SelectedShipmentID, htmlAttributes: null)
  </code></pre>
  
  <p>Why does the ActionLink(..., routeValues: Model.SelectedShipmentID,...) always return NULL to the Controller ? The Model.SelectedShipmentID is not updated with the DropDownList selected id. Please help as I'm running out of time on this.</p>