title: ASP.net MVC SelectList filed with all roles
body: <p>I'm trying to get All roles From my dataBase into select List.
  This my controler :</p>
  
  <pre><code>[AllowAnonymous]
  public ActionResult Register()
  {
      ViewBag.Roles = new SelectList(Roles.GetAllRoles(), "ROLEID", "ROLENAME");
      return View();
  }
  </code></pre>
  
  <p>My Model :</p>
  
  <pre><code>public List&lt;SelectListItem&gt; SelectedRoles { set; get; }
  </code></pre>
  
  <p>An this is my View :</p>
  
  <pre><code>&lt;div class="input-group"&gt;
     &lt;label for="Centre"&gt;Roles(s)&lt;/label&gt;
     @Html.ListBoxFor(m=&gt;m.SelectedRoles, (ViewBag.Roles as SelectList), new { @class = "chosen-select", data_placeholder = "Agent(s)." })
     @Html.ValidationMessageFor(m=&gt;m.SelectedRoles)
  &lt;/div&gt;
  </code></pre>
  
  <p>But I get this error :</p>
  
  <blockquote>
    <p>There is no ViewData item of type 'IEnumerable' that has the key 'SelectedRoles'.</p>
  </blockquote>
  
  <p>What's the problem ?</p>