title: Binding DropDownListFor In foreach , ASP.NET MVC
body: <p>Here is my code : </p>
  
  <p>ViewModel </p>
  
  <pre><code>public class FooViewModel{
     public Guid BarId { set;get }
  }
  </code></pre>
  
  <p>View : </p>
  
  <pre><code>@model IEnumerable&lt;FooViewModel&gt;
  @foreach (var c in Model)
  {
      &lt;div&gt;
          @Html.DropDownListFor(o =&gt; c.BarId , (List&lt;SelectListItem&gt;)ViewBag.BarCollection)
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>the problem is <code>DropDownListFor</code> create the options completely but binding doesn't work.</p>