title: MVC4 DropDownListFor Object reference not set to an instance of an object
body: <p>I'm about to go mad trying to figure this out. I'm newer to MVC but have become pretty comfortable with it.</p>
  
  <p>I am trying to place a Dropdown List on a View but keep getting "Object reference not set to an instance of an object" on the line that is calling the DropDownListFor. Here's what I have:</p>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public class UserModel
  {
      public class DietObject
      {
          public int Id { get; set; }
          public string Name { get; set; }
      }
  
      public IEnumerable&lt;DietObject&gt; DietOptions = new List&lt;DietObject&gt;
      {
          new DietObject { Id = 0, Name = "Meat" },
          new DietObject { Id = 1, Name = "Vegetarian" }
      };
  
      [Required]
      [StringLength(15)]
      [Display(Name = "Diet:")]
      public string Diet { get; set; }
  }
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>    [HttpGet]
      public ActionResult Registration()
      {
          return View();
      }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>    &lt;div class="fHeader"&gt;
          &lt;%: Html.LabelFor(m =&gt; m.Diet) %&gt;
      &lt;/div&gt;
      &lt;div class="fText"&gt;
          &lt;%: Html.DropDownListFor(m =&gt; m.Diet, new SelectList(Model.DietOptions, "Id", "Name", Model.DietOptions.First().Id))%&gt;
          &lt;%: Html.ValidationMessageFor(m =&gt; m.Diet)%&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <p>During the load of the page, it errors on this line:</p>
  
  <pre><code>&lt;%: Html.DropDownListFor(m =&gt; m.Diet, new SelectList(Model.DietOptions, "Id", "Name", Model.DietOptions.First().Id))%&gt;
  </code></pre>
  
  <p>Someone put me out of my misery. Much appreciated.</p>