title: MVC DropDownList values posted to model aren't bound
body: <p>DropDownLists are probably my least favourite part of working with the MVC framework. I have a couple of drop-downs in my form whose selected values I need to pass to an ActionResult that accepts a model as its parameter.</p>
  
  <p>The markup looks like this:</p>
  
  <pre><code>&lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.FileType)
  &lt;/div&gt;
  &lt;div class="editor-field"&gt;
      @Html.DropDownListFor(model =&gt; model.FileType.Variety, (SelectList)ViewBag.FileTypes)
  &lt;/div&gt;
  
  &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Status)
  &lt;/div&gt;
  &lt;div class="editor-field"&gt;
      @Html.DropDownListFor(model =&gt; model.Status.Status, (SelectList)ViewBag.Status)
  &lt;/div&gt;
  </code></pre>
  
  <p>And my controller action looks like this:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(int reviewid, ReviewedFile file)
  {
      if (ModelState.IsValid)
      {
          UpdateModel(file);
      }
  
      //repository.Add(file);
  
      return RedirectToAction("Files", "Reviews", new { reviewid = reviewid, id = file.ReviewedFileId });
  }
  </code></pre>
  
  <p>This should be all well and good except the values from the drop downs are being posted as null. When I look further into the ModelState errors, the cause is found to be:</p>
  
  <blockquote>
    <p>The parameter conversion from type
    'System.String' to type
    'PeerCodeReview.Models.OutcomeStatus'
    failed because no type converter can
    convert between these types.</p>
  </blockquote>
  
  <p>It shouldn't be this hard, but it is. So the question is; what do I need to do in order to get my model properties bound correctly?</p>
  
  <p>As an aside, I know I could pass in a FormCollection object, but that means changing significant parts of my unit tests that currently expect a strongly-typed model parameter.</p>