title: The ViewData item that has the key 'Attribute' is of type 'System.String' but must be of type 'IEnumerable<SelectListItem>'
body: <p>I'm binding Categories and Genders in Dropdownlist. My Model has two attributes Mapped to the columns in other tables :</p>
  
  <pre><code>        [Required(ErrorMessage = "Choose your category")]
          public string Category { get; set; }
  
          [ForeignKey("Category")]
          [NotMapped]
          public virtual Category Category_Name { get; set; }
  
          [Required(ErrorMessage = "Choose your category")]
          public string Gender { get; set; }
  
          [ForeignKey("Gender")]
          [NotMapped]
          public virtual Gender Gender_Name { get; set; }
  </code></pre>
  
  <p>My ProductsController have a method called "Create" which is used for uploading</p>
  
  <pre><code> public ActionResult Create()
          {
              ViewBag.Category = new SelectList(
                  db.Categories.ToList(),
                  "Category_ID",
                  "Category_Name")
                  ;
              ViewBag.Gender = new SelectList(
                  db.Genders.ToList(),
                  "Gender_ID",
                  "Gender_Name"
                  );
              return View();
          }
  
          //
          // POST: /Products/Create
  
          [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Create(Products products)
          {
              if (products.Image.ContentLength &gt; (2 * 1024 * 1024))
              {
                  ModelState.AddModelError("CustomError", "The Size of the
               Image is 2MB");
                  return View();
              }
              if (!(products.Image.ContentType == "image/jpeg" || 
                  products.Image.ContentType == "image/gif"))
              {
                  ModelState.AddModelError("CustomError", "File type allowed :
                jpeg and gif");
                  return View();
              }
  
              byte[] data = new byte[products.Image.ContentLength];
              products.Image.InputStream.Read(data, 0, 
              products.Image.ContentLength);
              products.Product_Photo = data;
              db.Products.Add(products);
              db.SaveChanges();
              return View(products);
          }
  </code></pre>
  
  <p>The Corresponding View is :</p>
  
  <pre><code>@model  eKart.Models.Products
  
  @{
      ViewBag.Title = "Create";
  }
  
  &lt;h2&gt;Create&lt;/h2&gt;
  
  @using (Html.BeginForm("Create", "Products", FormMethod.Post, new { enctype
                = "multipart/form-data" }))
  {
      @Html.AntiForgeryToken()
      @Html.ValidationSummary(true)
  
      &lt;fieldset&gt;
          &lt;legend&gt;Products&lt;/legend&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Product_Name)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Product_Name)
              @Html.ValidationMessageFor(model =&gt; model.Product_Name)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Product_Quantity)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Product_Quantity)
              @Html.ValidationMessageFor(model =&gt; model.Product_Quantity)
          &lt;/div&gt;
  
          &lt;div class="editor-label"&gt;
              @Html.LabelFor(model =&gt; model.Product_Price)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.EditorFor(model =&gt; model.Product_Price)
              @Html.ValidationMessageFor(model =&gt; model.Product_Price)
          &lt;/div&gt;
          &lt;div&gt;
              @Html.LabelFor(model=&gt;model.Product_Photo)
          &lt;/div&gt;
           &lt;div&gt;
  
              @Html.TextBoxFor(model=&gt; model.Image, new{type="file"})
              @Html.ValidationMessage("CustomError")
             &lt;/div&gt;
  
          &lt;div class ="editor-label"&gt;
             @Html.LabelFor(model =&gt; model.Category)
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.DropDownList("Category",
             (SelectList)ViewBag.Category,"Choose Category")
              @Html.ValidationMessageFor(model=&gt;model.Category)
          &lt;/div&gt;
          &lt;div class ="editor-label"&gt;
              @Html.LabelFor(model=&gt;model.Gender)
          &lt;/div&gt;
          &lt;div class ="editor-field"&gt;
              @Html.DropDownList("Gender",(SelectList)ViewBag.Gender,"Choose 
             Gender")
              @Html.ValidationMessageFor(model=&gt;model.Gender)
          &lt;/div&gt;
          &lt;p&gt;
              &lt;input type="submit" value="Create" /&gt;
          &lt;/p&gt;
      &lt;/fieldset&gt;
  }
  
  &lt;div&gt;
      @Html.ActionLink("Back to List", "Index")
  &lt;/div&gt;
  
  @section Scripts {
      @Scripts.Render("~/bundles/jqueryval")
  }
  </code></pre>
  
  <p>When I Submit the form I hit the error at "Category" which is mentioned above.I checked StackOverFlow but didn't find useful information.I really wanna know what's going on and where I'm doing wrong.Thanks in advance your help </p>