title: The ViewData item that has the key 'CategoryId' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>'?
body: <p>So my code was working before. I don't know what I did for this to happen and I can't seem to fix it. I've seen people say to reset the ModelState. ( ModelState.Clear(); ) But that didn't help. Also, it doesn't help that I'm still fairly new to MVC. Any help would be appreciated. Thanks.</p>
  
  <p>Controller:</p>
  
  <pre><code>    public ActionResult Create()
      {
          ActiveDirectoryModel adm = new ActiveDirectoryModel();
          ViewBag.notifyto = adm.FetchContacts();
          var model = Populate();
  
  
          return View(model);
      } 
  
      [HttpPost]
      public ActionResult Create(CreateViewModel model)
      {
          if (ModelState.IsValid)
          {
              model.leaf.Date = DateTime.Now.Date;
              model.leaf.Category = model.CategoryId;
              model.leaf.SubCategory = model.SubCategoryId;
              model.leaf.AssignedTo = model.AssignedToId;
              model.leaf.CoAssignedTo = model.CoAssignedToId;
              model.leaf.Status = model.StatusId;
              model.leaf.Priority = model.PriorityId;
              //model.lead.Parent = model.ParentID;
  
              db.LeafItems.AddObject(model.leaf);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          return View(model);
      }
  
      public CreateViewModel Populate()
      {
          ActiveDirectoryModel adm = new ActiveDirectoryModel();
          var model = new CreateViewModel
          {
              AssignedToItems = adm.FetchContacts(),
              CoAssignedToItems = adm.FetchContacts(),
              NotifyToItems = adm.FetchContacts(),
              CategoryItems =
                  from c in new IntraEntities().CategoryItems.ToList()
                  select new SelectListItem
                  {
                      Text = c.Name,
                      Value = c.ID.ToString()
                  },
              SubCategoryItems =
                  from sc in new IntraEntities().SubCategoryItems.ToList()
                  select new SelectListItem
                  {
                      Text = sc.Name,
                      Value = sc.ID.ToString()
                  },
              StatusItems =
                  from s in new IntraEntities().StatusItems.ToList()
                  where s.IsPriority == false
                  select new SelectListItem
                  {
                      Text = s.Name,
                      Value = s.ID.ToString()
                  },
              PriorityItems =
                  from p in new IntraEntities().StatusItems.ToList()
                  where p.IsPriority == true
                  select new SelectListItem
                  {
                      Text = p.Name,
                      Value = p.ID.ToString()
                  }
          };
          return model;
      }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;div class="createTopInner"&gt;
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(model =&gt; model.leaf.Category)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.DropDownListFor(model =&gt; model.CategoryId, Model.CategoryItems, "")
          @Html.ValidationMessageFor(model =&gt; model.leaf.Category)
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Model:</p>
  
  <pre><code>    public int CategoryId { get; set; }
      public IEnumerable&lt;SelectListItem&gt; CategoryItems { get; set; }
  </code></pre>