title: Values of dropdown lists are not passed back to the controller
body: <p>I have a view model which consists of a patient object and Visits collection. The view model is populated with all the correct property values and the properties display correctly in the Edit view. I also verified the property values in the view model before the model was passed to the view in the Edit (GET) action of the controller.</p>
  
  <p>The problem is, even if I change none of the properties while in the edit view, the properties  bound to dropdown lists (gender and condition) are not passed back to the Edit (POST) action of the controller. This results in an exception being thrown.</p>
  
  <p>The properties have values but somewhere they are getting lost. How do I troubleshoot this?</p>
  
  <p>ASP.NET MVC 4 RC</p>
  
  <pre><code>public ActionResult Edit(int id = 0)
  {
      var patient = this.db.Patients.Where(p =&gt; p.Id == id).FirstOrDefault();
      var visits = this.db.Visits.Where(v =&gt; v.PatientId == patient.Id &amp;&amp; v.IsActive).OrderByDescending(v =&gt; v.VisitDate);
  
      PatientEditViewModel model = new PatientEditViewModel();
      model.Patient = patient;
      model.Visits = visits;
  
      if (patient == null)
      {
          return this.HttpNotFound();
      }
  
      ViewBag.GenderId = new SelectList(this.db.Genders, "Id", "Name", patient.GenderId);
      ViewBag.HandednessId = new SelectList(this.db.Handednesses, "Id", "Name", patient.HandednessId);
  
      return this.View(model);
  }
  
  
  [HttpPost]
  public ActionResult Edit(PatientEditViewModel model)
  {
      Mapper.CreateMap&lt;PatientEditViewModel, Patient&gt;();
  
      var entity = Mapper.Map&lt;PatientEditViewModel, Patient&gt;(model);
  
      if (ModelState.IsValid)
      {
          this.db.Entry(entity).State = EntityState.Modified;
          this.db.SaveChanges();
      }
  
      this.ViewBag.GenderId = new SelectList(this.db.Genders, "Id", "Name", entity.GenderId);
      this.ViewBag.HandednessId = new SelectList(this.db.Handednesses, "Id", "Name", entity.HandednessId);
  
      return this.View(model);
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@model Web.Models.PatientEditViewModel
  
  @{
      ViewBag.Title = "XXX";
  }
  
  
  @using (Html.BeginForm()) {
      @Html.ValidationSummary(true)
  
      &lt;fieldset&gt;
          &lt;legend&gt;Patient&lt;/legend&gt;
  
          @Html.HiddenFor(model =&gt; model.Patient.Id)
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Patient.GenderId, "Gender")
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.DropDownFor("GenderId", String.Empty)
              @Html.ValidationMessageFor(model =&gt; model.Patient.GenderId)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Patient.HandednessId, "Handedness")
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.DropDownFor("HandednessId", String.Empty)
              @Html.ValidationMessageFor(model =&gt; model.Patient.HandednessId)
          &lt;/div&gt;
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Patient.Comments)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Patient.Comments)
              @Html.ValidationMessageFor(model =&gt; model.Patient.Comments)
          &lt;/div&gt;
  
          &lt;p&gt;
              &lt;input type="submit" value="Save" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  
  @Html.Partial("_CurrentAndPreviousVisits", Model.Visits)
  
  
  @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  
  
  }
  </code></pre>