title: cannot convert from 'System.Collections.Generic.IEnumerable<System.Web.Mvc.SelectListItem>' to 'string' while using ViewData for @Html.DropDownListFor
body: <p>I've found many posts regarding the same questions but none of them were with view data and connected with a repository. I need to use  only one class no separate class for <code>Countries</code> and <code>Gender</code>, please.</p>
  
  <p><strong>Error:</strong></p>
  
  <p><a href="https://i.stack.imgur.com/xdh3y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xdh3y.png" alt="enter image description here"></a></p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>[HttpGet]
          public ActionResult Member(int? MemberId)
          {
              if (MemberId == null)
              {
                  Member m = new Member();
                  ViewData["CountriesList"] = _dal.GetCountryList();
                  ViewData["GenderList"] = _dal.GetGenderList();
                  return View(m);
              }
              var data = _dal.GetMemberData(MemberId);
              if (data == null)
              {
                  return View();
              }
  
              return View(data);
          }
  </code></pre>
  
  <p><strong>Class</strong></p>
  
  <pre><code>public string Country { get; set; }
  public string Gender { get; set; }
  public string Address { get; set; }
  public int Phone { get; set; }
  public IEnumerable&lt;SelectListItem&gt; _CountriesList { get; set; }
  public IEnumerable&lt;SelectListItem&gt; _GenderList { get; set; }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code> &lt;div class="col-md-8"&gt;
                  &lt;div class="col-md-4"&gt;
                      &lt;label id="country"&gt;Country&lt;/label&gt;
                      @Html.DropDownListFor(m =&gt; m.Country, Model._CountriesList, ViewData["CountriesList"] as IEnumerable&lt;SelectListItem&gt;, new { @class = "form-control", placeholder = "-- Select Country --" })
                  &lt;/div&gt;
                  &lt;div class="col-md-4"&gt;
                      &lt;label id="gender"&gt;Gender&lt;/label&gt;&lt;br /&gt;
                      @Html.DropDownListFor(m =&gt; m.Gender, Model._GenderList, ViewData["GenderList"] as IEnumerable&lt;SelectListItem&gt;, new { @class = "form-control", placeholder = "-- Select Gender --" })
                  &lt;/div&gt;
              &lt;/div&gt;
  </code></pre>
  
  <p><strong>Repository</strong></p>
  
  <pre><code>[public IEnumerable&lt;SelectListItem&gt; GetCountryList()
          {
               var _country = new List&lt;SelectListItem&gt;();
              using (SqlConnection con = new SqlConnection(connectionString))
              {
                  SqlCommand cmd = new SqlCommand("sp_CountryList", con);
                  cmd.CommandType = CommandType.StoredProcedure;
                  cmd.Parameters.AddWithValue("@Flag", "getCountryList");
                  con.Open();
                  SqlDataReader sdr = cmd.ExecuteReader();
                  while (sdr.Read())
                  {
                      _country.Add(new SelectListItem { Text = sdr["CountryName"].ToString(), Value = sdr["rowId"].ToString() });
                  }
                  con.Close();
              }
              return _country;
          }]
  </code></pre>