title: DropDownList Binding to ActionResult Create Method MVC 4 VS2012
body: <p>I'm a brand new user here - but I've been searching for a couple of hours now to solve following problem:</p>
  
  <p>I've got 2 Entities - Category and Item.
  Each Item should belong to a Category - therefore I would like to have a DropDownList which shows all existing Categories when Creating a new Item.
  So far my code shows the DropDownList with all the Categories, but when I select a Category and Submit the form (POST) the value for Category is always null.
  This naturally causes ModelState.IsValid to be false, because Category isn't nullable.
  How can I get the User-Selected-Value into my Create(POST) method?</p>
  
  <pre><code>I've got a Controller with following Methods to Create a new Item:
  
  // GET Method
  public ActionResult Create()
  {
      ViewBag.Category = new SelectList(db.CategorySet, "Id", "CategoryName");
      return View();
  }
  [HttpPost]
  public ActionResult Create(Item item)
  {
      if (ModelState.IsValid)
      {
        db.ItemSet.Add(item);
        db.SaveChanges();
        return RedirectToAction("Index");
      }
  
  return View(item);
  }
  
  And this is the DropDownList in my View (Create.cshtml):
  &lt;div class="editor-field"&gt;
  @Html.DropDownList("Category", (IEnumerable&lt;SelectListItem&gt;) ViewBag.Categories, "--Select Category--")
  &lt;/div&gt;
  </code></pre>