title: The ViewData item that has the key 'MY KEY' is of type 'System.String' but must be of type 'IEnumerable<SelectListItem>'
body: <p>I am trying to populate a dropdown list from a database mapped with Linq-2-SQL, using ASP.NET MVC 2, and keep getting this error.</p>
  
  <p>I am so confused because I am declaring a variable of type <code>IEnumerable&lt;SelectListItem&gt;</code> on the second line, but the error makes me think this is not the case. I feel like this should be very simple, but I am struggling. Any help is appreciated.</p>
  
  <p>Here are the interesting bits of my controller:</p>
  
  <pre><code>public ActionResult Create()
  {
      var db = new DB();
      IEnumerable&lt;SelectListItem&gt; basetypes = db.Basetypes.Select(
          b =&gt; new SelectListItem { Value = b.basetype, Text = b.basetype });
      ViewData["basetype"] = basetypes;
      return View();
  }
  </code></pre>
  
  <p>And here are the interesting bits of my view:</p>
  
  <pre><code>&lt;div class="editor-label"&gt;
     &lt;%: Html.LabelFor(model =&gt; model.basetype) %&gt;
  &lt;/div&gt;
  &lt;div class="editor-field"&gt;
     &lt;%: Html.DropDownList("basetype") %&gt;
     &lt;%: Html.ValidationMessageFor(model =&gt; model.basetype) %&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Here is the POST action when submitting the Form  </p>
  
  <pre><code>// POST: /Meals/Create
  [HttpPost]
  public ActionResult Create(Meal meal)
  {
      if (ModelState.IsValid)
      {
          try
          {
              // TODO: Add insert logic here
              var db = new DB();
              db.Meals.InsertOnSubmit(meal);
              db.SubmitChanges();
              return RedirectToAction("Index");
          }
          catch
          {
              return View(meal);
          }
      }
      else
      {
          return View(meal);
      }
  }
  </code></pre>
  
  <p>Thanks.</p>