title: Bind DropDownListFor with List on ViewModel
body: <p>I'm trying to do this:</p>
  
  <p>This is my ViewModel and Model:</p>
  
  <pre><code>public class OpeningYearViewModel
  {
      public int OpeningYearId { get; set; }
      public string Description { get; set; }
      public List&lt;Grade&gt; GradesList { get; set; }
  }
  
  public class Grade
  {
      public int GradeId { get; set; }
      public string Name { get; set; }
      public int CurrencyId { get; set; }
      public int Cost { get; set; }
  }
  </code></pre>
  
  <p>This is my Controller. I build a <code>SelecList</code> here and pass it to the view through the <code>ViewBag</code></p>
  
  <pre><code>OpeningYearViewModel viewmodel = new OpeningYearViewModel {
  
      OpeningYearId = 1,
      Description = "2015 - II",
      GradesList = new List&lt;Grade&gt;
      {
          new Grade { GradeId = 1, Name = "Grade 1", CurrencyId = 1, Cost = 100 },
          new Grade { GradeId = 2, Name = "Grade 2", CurrencyId = 2, Cost = 200 },
          new Grade { GradeId = 3, Name = "Grade 3", CurrencyId = 2, Cost = 150 }
      }
  };
  
  SelectList list = new SelectList(
                      new List&lt;SelectListItem&gt; 
                      {
                          new SelectListItem { Text = "S/.", Value = "1"},
                          new SelectListItem { Text = "$", Value = "2"},
                       }, "Value" , "Text");
  
  ViewBag.currencyList = list;
  
  return View(viewmodel);
  </code></pre>
  
  <p>And in my View I need a DropDownListFor for every item on GradesList so I do this:</p>
  
  <pre><code>@model Test.Models.OpeningYearViewModel
  
  @for(int i = 0; i &lt; Model.GradesList.Count; i++)
  {
    @Html.DropDownListFor(x =&gt; x.GradesList[i].CurrencyId, new SelectList(ViewBag.currencyList, "Value", "Text"))
    @Model.GradesList[i].CurrencyId //This is just to know the CurrencyId on every item.
  }
  </code></pre>
  
  <p>I'm getting every select correctly rendered, but I can't get the correct option selected on the page load:
  <a href="http://i.stack.imgur.com/o8gXs.png" rel="nofollow">render of view</a></p>
  
  <p>It is possible to do what I'm trying to do and I'm doing something wrong, or DropDownListFor works in a different way?</p>
  
  <p>Thanks!</p>