title: How can i add a dropdownlist in the register model
body: <p>// this code thows up an error that there is no viewdata item of type //IEnumerable for Companytype</p>
  
  <p>//current code in RegisterModel</p>
  
  <pre><code>public class RegisterModel
  {
      [Required]
      [Display(Name = "User name")]
      public string UserName { get; set; }
  
      [Required]
      [Display(Name = "Email Address")]
      [DataType(DataType.EmailAddress)]
      public string Email { get; set; }
  
      [Required]
      [Display(Name = "Company Name")]
      public string CompName { get; set; }
  
  
      [Required]
      [Display(Name = "Company Type")]
      public IEnumerable&lt;SelectListItem&gt; CompTypeList { get; set; }
  
  
  
      [Required]
      [Display(Name = "Total number of Branches")]
      [Range(1,10,ErrorMessage = "The {0} must be at least {1}")]
      public int TotalBranches { get; set; }
  
      [Required]
      [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
      [DataType(DataType.Password)]
      [Display(Name = "Password")]
      public string Password { get; set; }
  
      [DataType(DataType.Password)]
      [Display(Name = "Confirm password")]
      [System.ComponentModel.DataAnnotations.Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
      public string ConfirmPassword { get; set; }
  
  
  
  
  
  
  }
  </code></pre>
  
  <p>//current code in view</p>
  
  <pre><code>        &lt;li&gt;
              @Html.LabelFor(m =&gt; m.UserName)
              @Html.TextBoxFor(m =&gt; m.UserName)
          &lt;/li&gt;
  
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.Email)
              @Html.TextBoxFor(m =&gt; m.Email)
          &lt;/li&gt;
  
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.CompName)
              @Html.TextBoxFor(m =&gt; m.CompName)
          &lt;/li&gt;
  
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.CompTypeList)
              @Html.DropDownList("Companytype","-select one-")
          &lt;/li&gt;
  
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.TotalBranches)
              @Html.TextBoxFor(m =&gt; m.TotalBranches)
          &lt;/li&gt;
  
  
  
  
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.Password)
              @Html.PasswordFor(m =&gt; m.Password)
          &lt;/li&gt;
          &lt;li&gt;
              @Html.LabelFor(m =&gt; m.ConfirmPassword)
              @Html.PasswordFor(m =&gt; m.ConfirmPassword)
          &lt;/li&gt;
  </code></pre>
  
  <p>//AccountController Register
      private DefaultDBEntities3 db = new DefaultDBEntities3();</p>
  
  <pre><code>    [AllowAnonymous]
      public ActionResult Register()
      {
          ViewBag.CompTypeList = new SelectList( "Companytype");
          return View();
      }
  
      protected override void Dispose(bool disposing)
      {
  
          db.Dispose();
          base.Dispose(disposing);
      }  
  </code></pre>
  
  <p>your assistance will be much appreciated</p>