title: Value cannot be null. Parameter name: items (DrodownList)
body: <p>I'm working with ASP.NET MVC4 and now I want to add a dropdownlist with data from my mysql database. This is what I do :</p>
  
  <p>In my <strong>view</strong> (Register.cshtml):`</p>
  
  <pre><code>&lt;div class="control-group"&gt;
      @Html.LabelFor(m =&gt; m.DistrictID, new { @class= "control-label"})
      &lt;div class="controls"&gt;
          @Html.DropDownListFor(model =&gt; model.DistrictID, new SelectList(ViewBag.Districts, "district_id", "district_name", Model.DistrictID))
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>In my <strong>Controller</strong> (AccountController):</p>
  
  <pre><code>[AllowAnonymous]
  public ActionResult Register()
  {
      var districts = repository.GetDistricts();
      ViewBag.Districts = districts;
  
      return View(new RegisterModel());
  }
  
  //
  // POST: /Account/Register
  
  [HttpPost]
  [AllowAnonymous]
  [ValidateAntiForgeryToken]
  public ActionResult Register(RegisterModel model)
  {
  
      if (ModelState.IsValid)
      {
          // Attempt to register the User
          try
          {
              MembershipService.CreateUser(model.Name, model.FamilyName, model.BirthDate, model.Sex, model.Nationality, model.Email, model.UserName, model.Password, model.Street, model.StreetNr);
  
              FormsAuthentication.SetAuthCookie(model.UserName, false);
              return RedirectToAction("Index", "Home");
          }
          catch (ArgumentException ae)
          {
              ModelState.AddModelError("", ae.Message);
          }
      }
  
      // If we got this far, something failed, redisplay form
      return View(model);
  }
  </code></pre>
  
  <p>I get the Districts from my <strong>Repository</strong> like this:</p>
  
  <pre><code> public IQueryable&lt;district&gt; GetDistricts()
   {
       return from district in entities.districts
              orderby district.district_name
              select district;
   }
  </code></pre>
  
  <p>My RegisterModel:</p>
  
  <pre><code>public class RegisterModel
  {
      [Required]
      [Display(Name = "Given name")]
      public string Name { get; set; }
  
      [Required]
      [Display(Name = "Family name")]
      public string FamilyName { get; set; }
  
      [Required]
      [Display(Name = "Birthdate")]
      public DateTime BirthDate { get; set; }
  
      [Required]
      [Display(Name = "Sex")]
      public string Sex { get; set; }
  
      [Required]
      [Display(Name = "Nationality")]
      public string Nationality { get; set; }
  
      [Required]
      [Display(Name = "Email")]
      public string Email { get; set; }
  
      [Required]
      [Display(Name = "User name")]
      public string UserName { get; set; }
  
      [Required]
      [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
  
      [DataType(DataType.Password)]
      [Display(Name = "Confirm password")]
      [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
      public string ConfirmPassword { get; set; }
  
      [Required]
      [Display(Name = "Street")]
      public string Street { get; set; }
  
      [Required]
      [Display(Name = "Street Number")]
      public int StreetNr { get; set; }
  
      [Required]
      [Display(Name = "District")]
      public IEnumerable&lt;SelectListItem&gt; Districts { get; set; }
  
      public int DistrictID { get; set; }
  }
  </code></pre>
  
  <p>The dropdownlist is filled with districts but when I click on "Register" I get this error:</p>
  
  <blockquote>
    <p>Value cannot be null.
    Parameter name: items</p>
    
    <p>Description: An unhandled exception occurred during the execution of
    the current web request. Please review the stack trace for more
    information about the error and where it originated in the code. </p>
    
    <p>Exception Details: System.ArgumentNullException: Value cannot be null.
    Parameter name: items</p>
  </blockquote>
  
  <p>When I debug the method I see that the ModelState is NOT valid. <br>
  Key 11 is DistrictID and includes the districtid but Key 12 is Districts and gives the error: <code>"The district field is required"</code> ...</p>
  
  <p>What am I doing wrong?</p>