title: There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key country
body: <p>While binding dropdown in MVC, I always get this error: <code>There is no ViewData item of type 'IEnumerable&lt;SelectListItem&gt;' that has the key country</code>.</p>
  
  <p><strong>View</strong></p>
  
  <pre><code>@Html.DropDownList("country", (IEnumerable&lt;SelectListItem&gt;)ViewBag.countrydrop,"Select country")
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>List&lt;Companyregister&gt; coun = new List&lt;Companyregister&gt;();
  coun = ds.getcountry();
  
  List&lt;SelectListItem&gt; item8 = new List&lt;SelectListItem&gt;();
  foreach( var c in coun )
  {
      item8.Add(new SelectListItem
      {
          Text = c.country,
          Value = c.countryid.ToString()
      });
  }
  
  ViewBag.countrydrop = item8;
  return View();
  </code></pre>
  
  <p>I don't know how to resolve it.</p>