title: Steve Sanderson's BeginCollectionItem helper won't bind correctly
body: <p>I am using Steve Sanderson's BeginCollectionItem helper and ran into a problem. I have a form that has an option to add unlimited reward fields. I am using his helper since it solved this problem with how to keep generating the fields and not have to worry about how to bind it when the form gets submitted.</p>
  
  <p>I have in this same form some checkboxes that there is an unknown amount. The difference with this one versus the rewards is the unknown amount will become known after a database call and will be known by the time the code gets to the view.</p>
  
  <p>So my code looks like this</p>
  
  <pre><code>  public class FrmVm
      {
          public Guid Id { get; set; }
          public string Name { get; set; }
          public bool Active { get; set; }
  
          public IList&lt;WarrantyFeaturesVm&gt; WarrantyFeaturesVm { get; set; } // this is the checkbox ones.
           public IList&lt;RewardVms&gt; RewardVms { get; set; } // this is the dyanmic one that I needed the helper for
  
          public CbCreditCardFrmVm()
          {
              Active = true;
              WarrantyFeaturesVm = new List&lt;WarrantyFeaturesVm&gt;();
               RewardVms = new List&lt;RewardVms&gt;();
          }
      }
  
  
      // view
  
      @foreach (var tier in Model.RewardVms)
      {
              @Html.Partial("GenerateReward", tier)   // in this partial view in the  BeginCollectionItem                 
       }
  
  
  
   @foreach (var warranties in Model.WarrantyFeaturesVm)
  {
      using (Html.BeginCollectionItem("WarrantyFeaturesVm"))
      { 
        &lt;span&gt;@warranties.Name:&lt;/span&gt;
        @Html.TextBoxFor(x =&gt; warranties.FeatureId)
        @Html.CheckBoxFor(x =&gt; warranties.HasFeature)
      }
  }
  </code></pre>
  
  <p>I am using jquery to submit the data by using serializeArray(). When it goes to the server it bind all the dynamic ones correctly and even binds the Warranty to the Collection(the collection count is 1). Yet it never binds anything insides the WarrantyFeaturesVm, everything is left as default.</p>
  
  <p>if I remove  using <code>(Html.BeginCollectionItem("WarrantyFeaturesVm"))</code> then it won't even bind the collection.</p>
  
  <p>Anyone know why it is not binding anything in the collection?</p>
  
  <p><strong>Edit</strong></p>
  
  <pre><code>// for loop (works)
  &lt;form method="post" id="" action="" class="ui-formwizard ui-helper-reset ui-widget ui-widget-content ui-corner-all" novalidate="novalidate"&gt;
  
  &lt;span id="" class="step ui-formwizard-content ui-helper-reset ui-corner-all" style="display: none;"&gt;
  
  &lt;input type="hidden" value="6aa20677-d367-4e2a-84f0-9fbe00deb191" name="WarrantyFeaturesVm[0].FeatureId" id="WarrantyFeaturesVm_0__FeatureId" data-val-required="The FeatureId field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;    &lt;span&gt;Purchase&lt;/span&gt;
  &lt;input type="checkbox" value="true" name="WarrantyFeaturesVm[0].HasFeature" id="WarrantyFeaturesVm_0__HasFeature" data-val-required="The HasFeature field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;&lt;input type="hidden" value="false" name="WarrantyFeaturesVm[0].HasFeature" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;
  
  &lt;/form&gt;
  
  
  
  
  //foreach loop beginItemCollection(does not work)
  
  
  &lt;form method="post" id="" action="" class="ui-formwizard ui-helper-reset ui-widget ui-widget-content ui-corner-all" novalidate="novalidate"&gt;
  
  &lt;span id="" class="step ui-formwizard-content ui-helper-reset ui-corner-all" style="display: inline;"&gt;
  
  &lt;input type="hidden" value="68ba9241-c409-4f4b-96da-cce13b127c1e" autocomplete="off" name="WarrantyFeaturesVm.index" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;
  &lt;input type="hidden" value="6aa20677-d367-4e2a-84f0-9fbe00deb191" name="WarrantyFeaturesVm[68ba9241-c409-4f4b-96da-cce13b127c1e].war.FeatureId" id="WarrantyFeaturesVm_68ba9241-c409-4f4b-96da-cce13b127c1e__war_FeatureId" data-val-required="The FeatureId field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;            &lt;span&gt;Purchase&lt;/span&gt;
  &lt;input type="checkbox" value="true" name="WarrantyFeaturesVm[68ba9241-c409-4f4b-96da-cce13b127c1e].war.HasFeature" id="WarrantyFeaturesVm_68ba9241-c409-4f4b-96da-cce13b127c1e__war_HasFeature" data-val-required="The HasFeature field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;&lt;input type="hidden" value="false" name="WarrantyFeaturesVm[68ba9241-c409-4f4b-96da-cce13b127c1e].war.HasFeature" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;
  
  &lt;/span&gt;
  
  &lt;/form&gt;
  
  
  
  
  
  //for loop beginItemCollection (does not work)
  &lt;form method="post" id="" action="" class="ui-formwizard ui-helper-reset ui-widget ui-widget-content ui-corner-all" novalidate="novalidate"&gt;
  
  
  &lt;span id="" class="step ui-formwizard-content ui-helper-reset ui-corner-all" style="display: none;"&gt;
  
  &lt;input type="hidden" value="fe3fbc82-a2df-476d-a15a-dacd841df97e" autocomplete="off" name="WarrantyFeaturesVm.index" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;
  &lt;input type="hidden" value="6aa20677-d367-4e2a-84f0-9fbe00deb191" name="WarrantyFeaturesVm[fe3fbc82-a2df-476d-a15a-dacd841df97e].WarrantyFeaturesVm[0].FeatureId" id="WarrantyFeaturesVm_fe3fbc82-a2df-476d-a15a-dacd841df97e__WarrantyFeaturesVm_0__FeatureId" data-val-required="The FeatureId field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;            &lt;span&gt;Purchase&lt;/span&gt;
  &lt;input type="checkbox" value="true" name="WarrantyFeaturesVm[fe3fbc82-a2df-476d-a15a-dacd841df97e].WarrantyFeaturesVm[0].HasFeature" id="WarrantyFeaturesVm_fe3fbc82-a2df-476d-a15a-dacd841df97e__WarrantyFeaturesVm_0__HasFeature" data-val-required="The HasFeature field is required." data-val="true" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;&lt;input type="hidden" value="false" name="WarrantyFeaturesVm[fe3fbc82-a2df-476d-a15a-dacd841df97e].WarrantyFeaturesVm[0].HasFeature" class="ui-wizard-content ui-helper-reset ui-state-default"&gt;
  
  &lt;/span&gt;
  
  &lt;span id="adminSettings" class="step ui-formwizard-content ui-helper-reset ui-corner-all" style="display: inline;"&gt;
  
  &lt;/form&gt;
  </code></pre>