title: ViewModel's list is null in action
body: <p>I'm working on my first ASP.NET MVC 3 application and I've got a View that looks like this:</p>
  
  <pre><code>@model IceCream.ViewModels.Note.NotesViewModel
  @using (Html.BeginForm())
  {
      @Html.ValidationSummary(true)
      @Html.TextBoxFor(m =&gt; m.Name)
  
      foreach (var item in Model.Notes)
      {
          @Html.EditorFor(m =&gt; item);
      }
  
      &lt;input type="submit" value="Submit"/&gt;
  }
  </code></pre>
  
  <p>And I have an EditorTemplate that looks like this:</p>
  
  <pre><code>@model IceCream.ViewModels.Note.NoteViewModel
  &lt;div&gt;
      @Html.HiddenFor(m =&gt; m.NoteID)
      @Html.TextBoxFor(m =&gt; m.NoteText)
      @Html.CheckBoxFor(m =&gt; m.IsChecked)
  &lt;/div&gt;
  </code></pre>
  
  <p>NotesViewModel looks like so:</p>
  
  <pre><code>    public class NotesViewModel
      {
          public string Name { get; set; }
          public IEnumerable&lt;NoteViewModel&gt; Notes { get; set; }
      }
  </code></pre>
  
  <p>NoteViewModel looks like this:</p>
  
  <pre><code>public class NoteViewModel
  {
      public int NoteID { get; set; }
      public System.DateTime Timestamp { get; set; }
      public string NoteText { get; set; }
      public bool IsChecked { get; set; }
  }
  </code></pre>
  
  <p>The NotesViewModel is populated just fine when it is passed to the view.  However when the submit button is clicked, the controller action handling the post has only the value for the Name property of the viewmodel.  The Notes property - the list of notes that have been checked/unchecked by the user - is null.  I've got a disconnect between the populating of those TextBoxFor and CheckBoxFor elements when the view is displayed and the ViewModel being sent back.  Guidance on this?</p>
  
  <hr>
  
  <p><strong>SOLUTION</strong>
  Thanks go to Mystere Man for setting me straight on this.  As I understand it, essentially by changing my loop to</p>
  
  <p><code>@Html.EditorFor(m =&gt; m.Notes)</code></p>
  
  <p>changes the underlying HTML, which I understand provides for the proper model binding on the post.  Looking at the resulting HTML, I see that I get the following generated for one of the Notes:</p>
  
  <pre><code>&lt;div&gt;
    &lt;input id="Notes_0__NoteId" type="hidden" value="1" name="Notes[0].NoteId"&gt;
    &lt;input id="Notes_0__NoteText" type="text" value="Texture of dessert was good." name="Notes[0].NoteText"&gt;
    &lt;input id="Notes_0__IsChecked" type="checkbox" value="true" name="Notes[0].IsChecked&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Which is different than this HTML generated by my original code:</p>
  
  <pre><code>&lt;div&gt;
     &lt;input id="item_NoteId" type="hidden" value="1" name="item.NoteId&gt;
     &lt;input id="item_NoteText" type="text" value="Texture of dessert was good." name="item.NoteText" &gt;
     &lt;input id="item_IsChecked" type="checkbox" value="true" name="item.IsChecked"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>By looping through the Notes, the generated HTML essentially loses any references to the viewmodel's Notes property and while the HTML gets populated correctly, the setting of the checkbox values has no way to communicate their values back to the viewmodel, which I guess is the point of the model binding.  </p>
  
  <p>So I learned something, which is good. </p>