title: ASP .NET MVC - Creating a partial view only works for 'Edit' actionresult and not 'Create'
body: <p>I have created a partial view for use by by the 'Edit' view of my model.  I can successfully edit records but when using the partial view for my 'Create' view I get a null reference exception.</p>
  
  <p>This is my partial view:</p>
  
  <pre><code>@model MvcA.Models.Reason       
  
          @Html.LabelFor(model =&gt; model.reason)
          @Html.EditorFor(model =&gt; model.reason)
  
          @Html.LabelFor(model =&gt; model.Contract)
          @Html.DropDownList("ContractId",
          new SelectList(ViewBag.Contract as System.Collections.IEnumerable,
         "ContractId","Name",Model.ContractID));
  </code></pre>
  
  <p>And POST ActionResult:</p>
  
  <pre><code>[HttpPost]
  public ActionResult Create(Reason reason)
  {
     if (ModelState.IsValid)
              {
                  db.Reason.Add(reason);
                  db.SaveChanges();
                  return RedirectToAction("Index");
              }
              //invalid ...
  </code></pre>
  
  <p>The GET Create:</p>
  
  <pre><code>public ActionResult Create()
      {
          ViewBag.Contract = db.Contract.OrderBy(g =&gt; g.Name).ToList();
          var reason = new Reason();
          return View(reason);
      } 
  </code></pre>
  
  <p>Upon entering/selecting valid values the form submit will result in Visual Studio exiting out to the 'DropDownList' found in the partial view with a 'NullReferenceException was unhandled'.</p>
  
  <p>How do I determine what is causing the null error? (I'm new to MVC)</p>
  
  <p><strong>UPDATE</strong>:  The error appears to be related to the [HttpPost] Create method in my controller.  I was naming the input class using the same name as one of the fields in the model...this appears to have broken the program with the null reference exception.</p>