title: Create DropDownList for an ASP.NET MVC5 Relation
body: <p>I'm stuck creating a proper create/edit view in ASP.NET MVC5. I've got two models <code>Dog</code> and <code>Human</code>. A dog belongs to one <code>Human</code>. I'm trying to create a dropdown in the <code>create</code> and <code>edit</code> views for <code>Dog</code> that'll allow me to select a <code>Human</code> by name for that particular <code>Dog</code>. Here are my models:</p>
  
  <p>Human:</p>
  
  <pre><code>public class Human
  {
      public int ID { get; set; }
      public string Name { get; set; }
  }
  </code></pre>
  
  <p>Dog:</p>
  
  <pre><code>public class Dog
  {
      public int ID { get; set; }
      public string Name { get; set; }
      public Human Human { get; set; }
  }
  </code></pre>
  
  <p>My create action:</p>
  
  <pre><code>// GET: /Dog/Create
  public ActionResult Create()
  {
      ViewBag.HumanSelection = db.Humen.Select(h =&gt; new SelectListItem
      {
          Value = h.ID.ToString(),
          Text = h.Name
      });
      return View();
  }
  </code></pre>
  
  <p>And here is the relevant part of my view:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
      @Html.LabelFor(model =&gt; model.Human.Name, new { @class = "control-label col-md-2" })
      &lt;div class="col-md-10"&gt;
          @Html.DropDownListFor(model =&gt; model.Human, ViewBag.HumanSelection);
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I get the following error when I run this:</p>
  
  <pre><code>Compiler Error Message: CS1973: 'System.Web.Mvc.HtmlHelper&lt;Test.Models.Dog&gt;' has no applicable method named 'DropDownListFor' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
  </code></pre>
  
  <p>I'm new to C# &amp; the Entity framework. What am I doing wrong? Is there a way of doing this without manually querying the database? Something like the collection form helpers in Rails?
  I've followed a bunch of tutorials that are either old or too complicated for me to follow.</p>