title: ViewModel collection property lost values after posting back to controller action in MVC 3
body: <p>I have my view models :</p>
  
  <pre><code>public class POReceiptViewModel
  {
      public virtual int PONumber { get; set; }
      public virtual string VendorCode { get; set; }
  
      public virtual IList&lt;POReceiptItemViewModel&gt; POReceiptItems { get; set; }
  
      public POReceiptViewModel()        
      {
          POReceiptItems = new List&lt;POReceiptItemViewModel&gt;();
      }
  }
  
  public class POReceiptItemViewModel
  {
      public virtual string ItemCode { get; set; }
      public virtual string ItemDesription { get; set; }
      public virtual decimal OrderedQuantity { get; set; }
      public virtual decimal ReceivedQuantity { get; set; }
      public virtual DateTime ReceivedDate { get; set; }
  
      public POReceiptItemViewModel()
      {
          ReceivedDate = DateTime.Now;
      }
  }
  </code></pre>
  
  <p>Then my controller has two actions, one get and one post:</p>
  
  <pre><code>public ActionResult CreatePOReceipt(int poNumber)
  {
      PurchaseOrder po = PurchasingService.GetPurchaseOrder(poNumber);
      POReceiptViewModel poReceiptViewModel = ModelBuilder.POToPOReceiptViewModel(po);
      return View("CreatePOReceipt", poReceiptViewModel);
  }
  
  [HttpPost]
  public ActionResult CreatePOReceipt(POReceiptViewModel poReceiptViewModel)
  {
      // Here the problem goes. The items in the poReceiptViewModel.POReceiptItems has lost. the count became zero.
      return View("Index");
  }
  </code></pre>
  
  <p>And in my View, I can display the model properly and by using @Html.HiddenFor&lt;> I can persist view model data as I wanted to. But not on the List&lt;> navigation property.</p>
  
  <pre><code>@model POReceiptViewModel
  
  @using (Html.BeginForm())
  {   
      &lt;fieldset&gt;
          &lt;legend&gt;Purchase Order&lt;/legend&gt;
          &lt;label&gt;For PO # :&lt;/label&gt;
          @Html.HiddenFor(m =&gt; m.PONumber)    
          @Html.DisplayTextFor(m =&gt; m.PONumber)
          &lt;label&gt;Vendor Code :&lt;/label&gt;
          @Html.HiddenFor(m =&gt; m.VendorCode)  
          @Html.DisplayTextFor(m =&gt; m.VendorCode)
      &lt;/fieldset&gt;
  
      &lt;fieldset&gt;
          &lt;legend&gt;Received Items&lt;/legend&gt;
  
          &lt;table class="tbl" id="tbl"&gt;
             &lt;thead&gt;
             &lt;tr&gt;
             &lt;th&gt;Item Code&lt;/th&gt;&lt;th&gt;Item Description&lt;/th&gt;&lt;th&gt;OrderedQuantity&lt;/th&gt;&lt;th&gt;Received Quantity&lt;/th&gt;&lt;th&gt;Received Date&lt;/th&gt;
             &lt;/tr&gt;
             &lt;/thead&gt;
             &lt;tbody&gt;
             @Html.HiddenFor(m =&gt; m.POReceiptItems) // I'm not really sure if this is valid
             @if (Model.POReceiptItems.Count &gt; 0)
              {
                  foreach (var item in Model.POReceiptItems)
                  {       
                      &lt;tr&gt;
                          &lt;td&gt;@Html.DisplayTextFor(i =&gt; item.ItemCode)&lt;/td&gt;@Html.HiddenFor(i =&gt; item.ItemCode)    
                          &lt;td&gt;@Html.DisplayTextFor(i =&gt; item.ItemDesription)&lt;/td&gt;@Html.HiddenFor(i =&gt; item.ItemDesription)    
                          &lt;td&gt;@Html.DisplayTextFor(i =&gt; item.OrderedQuantity)&lt;/td&gt;@Html.HiddenFor(i =&gt; item.OrderedQuantity)  
                          &lt;td&gt;@Html.TextBoxFor(i =&gt; item.ReceivedQuantity)&lt;/td&gt;
                          &lt;td&gt;@Html.TextBoxFor(i =&gt; item.ReceivedDate)&lt;/td&gt;
                      &lt;/tr&gt;
                  }
              }
             &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/fieldset&gt;
      &lt;input type="submit" name="Received" value="Received" /&gt;
  }
  </code></pre>
  
  <p><strong>PROBLEM:</strong>
  POReceiptItems lost when the form submitted. As much as possible I don't want to use TempData["POReceiptItems"] = Model.POReceiptItems but even if I use it, the value entered into ReceivedQuantity and ReceivedDate are not save into the TempData.</p>
  
  <p>Thanks in advance!</p>