title: How to set default value for ASP.NET MVC DropDownList from ViewBag
body: <p>In the controller Index I have the following:</p>
  
  <pre><code>ViewBag.Assignees = (await GetAllUsers()).Select(a =&gt;
              new SelectListItem
              {
                  Text = a.DisplayName,
                  Value = a.Username,
                  Selected = a.DisplayName == "John Smith"
              }).OrderBy(x =&gt; x.Text).ToList();
  </code></pre>
  
  <p>In the View, I have the following:</p>
  
  <pre><code> @Html.DropDownListFor(model =&gt; model.Assignee, 
                         ViewBag.Assignees as List&lt;SelectListItem&gt;, 
                         "Select Assignee", 
                         new { id = "ddlAssignee", @class = "form-control"})
  </code></pre>
  
  <p>The dropdownlist populates as expected, however, the default (selected = true) value, which does exist, does not get set. Can someone advise what is wrong in the above?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>By Changing the <code>SelectListItem.Value</code> to <code>a.DisplayName</code> (same as <code>SelectedListItem.Text</code>) I achieved it. Still not sure what prevents the dropdownlist from displaying the item with <code>Selected = true</code></p>