title: There is no ViewData item of type IEnumerable<SelectListItem>' that has the key 'DCResults'
body: <p>I have looked into this problem on other questions on Stackoverflow but none that I have found seem to be the right version of the problem for this code.</p>
  
  <p>I thought that it might be because the list in the model is the same as the one in the controller.
  Here is my Controller code:</p>
  
  <pre><code>String[] excelSheets = new String[dt.Rows.Count];
                      int t = 0;
  
                      foreach (DataRow row in dt.Rows)
                      {
                          excelSheets[t] = row["TABLE_NAME"].ToString();
                          t++;
                      }
                      //TODO:Lägga till varje column så att dom kan flyttas till vyn innan dom flyttas till denna innläggning i databasen.
                      OleDbConnection excelConnection1 = new OleDbConnection(excelConnectionString);
                      string query = string.Format("Select * from [Sheet 1$]", excelSheets[0]);
                      using (OleDbDataAdapter dataAdapter = new OleDbDataAdapter(query, excelConnection1))
                      {
                          dataAdapter.Fill(ds);
                      }
  
  
                      if (fileExtension.ToString().ToLower().Equals(".xml"))
                      {
                          string FileLocation = Server.MapPath("~/Content/") + Request.Files["FileUpload"].FileName;
                          if (System.IO.File.Exists(fileLocation))
                          {
                              System.IO.File.Delete(FileLocation);
                          }
                          Request.Files["FileUpload"].SaveAs(fileLocation);
                          XmlTextReader xmlreader = new XmlTextReader(fileLocation);
                          ds.ReadXml(xmlreader);
                          xmlreader.Close();
  
                      }
  
  
                      o.DCResults = new List&lt;string&gt;();
  
                      for (int y = 0; y &lt; ds.Columns.Count; y++)
                      {
  
                          string dc = ds.Columns[y].ColumnName.ToString();
  
                          o.DCResults.Add(dc.ToString());
  
                      }
                      DataSet exceldata = new DataSet();
  
                          exceldata.Tables.Add(ds);
  
                  }
              }
  
              //TODO: Errormessage here:
              return View();
          }
  </code></pre>
  
  <p>And this is my view (where the error occurs when I try to make a dropdownlist with the list result from the DCResults list so that users can map each of the results to a column name that I get from the same model that I use for the list.):</p>
  
  <pre><code>@model BFProj2.Models.OurColumns
  
  @{
      ViewBag.Title = "Import";
      Layout = "~/Views/Shared/_Layout.cshtml";
  }
  
  &lt;h2&gt;Import&lt;/h2&gt;
  
  Firstname:
  
  &lt;body&gt;
      @Html.DisplayNameFor(modelItem =&gt; modelItem.FirstName)
      @Html.EditorFor(modelItem =&gt; modelItem.FirstName)
      &lt;div class="display-field"&gt;
          @Html.DropDownList("DCResults",(IEnumerable&lt;SelectListItem&gt;)ViewBag.DCResults)
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And here is my model where I get the list and the new column names:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Linq;
  using System.ComponentModel;
  
  namespace BFProj2.Models
  {
      public class OurColumns
      {
          public Guid ID { get; set; }
  
          [DisplayName("Password")]
          public string Password { get; set; }
  
          [DisplayName("Email")]
          public string Email { get; set; }
  
          [DisplayName("Comment")]
          public string Comment { get; set; }
  
          [DisplayName("Username")]
          public string UserName { get; set; }
  
          [DisplayName("Firstname")]
          public string FirstName { get; set; }
  
          [DisplayName("Lastname")]
          public string LastName { get; set; }
  
          [DisplayName("Last activity date")]
          public DateTime? LastUpdateDate { get; set; }
  
          [DisplayName("Title")]
          public string Title { get; set; }
  
          [DisplayName("Abstract number")]
          public int AbstrNum { get; set; }
  
          [DisplayName("Poster title")]
          public string PosterTitle { get; set; }
  
          [DisplayName("Workshop")]
          public string Workshop { get; set; }
  
          [DisplayName("Keywords")]
          public string Keywords { get; set; }
  
          [DisplayName("Institution")]
          public string Institution { get; set; }
  
          [DisplayName("Collaboration email")]
          public string CollabEmail { get; set; }
  
          [DisplayName("DCResults")]
          public List&lt;string&gt; DCResults { get; set; }
      }
  }
  </code></pre>