title: Binding Selected Value in DropDownListFor with-in for statement
body: <p>I have a view which allows editing of multiple address items concurrently.  Binding of the text box works fine however the drop down list does not recognize the selected value.</p>
  
  <p>My ViewModels are:</p>
  
  <pre><code>public class AddressesViewModel
  {
      public List&lt;AddressViewModel&gt; Addresses { get; set; }
  }
  
  public class AddressViewModel
  {
      public string Street { get; set; }
      public string StateSelected { get; set; }
      public IEnumerable&lt;SelectListItem&gt; States { get; set; }
  
      public AddressViewModel()
      {
          this.States = new List&lt;SelectListItem&gt; { 
              new SelectListItem(),
              new SelectListItem { Text = "New Jersey", Value = "NJ"}, 
              new SelectListItem { Text = "New York", Value = "NY"}, 
              new SelectListItem { Text = "Pennsylvania", Value = "PA" },
              new SelectListItem { Text = "Rhode Island", Value = "RI" }
          };
      }
  }
  </code></pre>
  
  <p>my controller action is:</p>
  
  <pre><code>public ActionResult Index()
  {
      var addressesViewModel = new AddressesViewModel();
      addressesViewModel.Addresses = new List&lt;AddressViewModel&gt;() { 
          new AddressViewModel{
              Street = "some road", 
              StateSelected = "PA"
          },
          new AddressViewModel{
              Street = "some other road", 
              StateSelected = "NJ"
          }
     };
  
     return View(addressesViewModel);
  }
  </code></pre>
  
  <p>and my view is:</p>
  
  <pre><code>@model HelloWorld.Models.AddressesViewModel
  
  
  @for (int i = 0; i &lt; Model.Addresses.Count(); i++)
  {
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(modelItem =&gt; Model.Addresses[i].Street)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.EditorFor(modelItem =&gt; Model.Addresses[i].Street)
      &lt;/div&gt;
  
      &lt;div class="editor-label"&gt;
          @Html.LabelFor(modelItem =&gt; Model.Addresses[i].StateSelected)
      &lt;/div&gt;
      &lt;div class="editor-field"&gt;
          @Html.DropDownListFor(modelItem =&gt; Model.Addresses[i].StateSelected, Model.Addresses[i].States)
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>I tested the view using a single item (bound to AddressViewModel) and it worked fine.</p>