title: MVC3 Dropdownlist - String / Role Value
body: <p>Ok here is my challenge:
  I want to create a dropdownlist with three strings in my Register View - "Please Select", "I am a client", and "I am a vendor". When the user selects the "I am a client" and submits he is added to the "Client" role. When the user selects the "I am a Vendor" role he is added to the "Vendor" role. If the user doesn't select either and leaves on "Please select" validation occurs.</p>
  
  <p>I can get the roles to directly populate via the ViewBag. Here's how:
  <br /><br />Register.cshtml - </p>
  
  <pre><code>        &lt;div class="editor-label"&gt;
              @Html.LabelFor(m =&gt; m.Role, "I am a:")
          &lt;/div&gt;
          &lt;div class="editor-field"&gt;
              @Html.DropDownList("Role", ViewBag.Roles as SelectList,"Please Select")
          &lt;/div&gt;
  </code></pre>
  
  <p><br /><br />AccountModel.cs -</p>
  
  <pre><code>public class RegisterModel
  {
  
      [Required]
      [Display(Name = "Role")]
      public string Role { get; set; }
  </code></pre>
  
  <p><br /><br />AccountController.cs -</p>
  
  <pre><code>    public ActionResult Register()
      {
  
          ViewBag.Roles = new SelectList(Roles.GetAllRoles().ToList());
          return View();
  </code></pre>
  
  <p><br /><br />
  What I still need to accomplish -
  Currently the dropdownlist only populates the actual roles. This is not what I want though.</p>
  
  <p>How do I instead create a dropdownlist for three strings in my Register View - "Please Select", "I am a client", and "I am a vendor".</p>
  
  <p>I have no hair left on this one and will be grateful to anyone who can help me to figure this one out. Thanks.</p>