title: ViewModel IEnum<> property is returning null  (not binding) when contained in a partial view?
body: <p>I have a ViewModel that contains a Product type and an IEnumerable&lt; Product > type. I have one main view that displays the ViewModel.Product at the top of the page but then I have a partial view that renders the ViewModel.IEnumerable&lt; Product > data.  On the post the first level product object comes back binded from the ViweModel whereas the ViewModel.IEnumerable&lt; Product > is coming back null.</p>
  
  <p>Of course if I remove the partial view and move the IEnumerable&lt; Product > view to the main View the contents comes back binded fine.  However, I need to put these Enumerable items in a partial view because I plan on updating the contents dynamically with Ajax.</p>
  
  <p>Why is the IEnumerable&lt; Prouduct> property not getting binded when it's placed in a partial view? Thx!</p>
  
  <p>Models:</p>
  
  <pre><code>public class Product
  {
      public int ID { get; set; }
      public string Name { get; set; }
      public decimal Price { get; set; }
  }
  
  public class ProductIndexViewModel
  {
      public Product NewProduct { get; set; }
      public List&lt;Product&gt; Products { get; set; }
  }
  
  public class BoringStoreContext
  {
      public BoringStoreContext()
      {
          Products = new List&lt;Product&gt;();
          Products.Add(new Product() { ID = 1, Name = "Sure", Price = (decimal)(1.10) });
          Products.Add(new Product() { ID = 2, Name = "Sure2", Price = (decimal)(2.10) });
      }
      public List&lt;Product&gt; Products { get; set; }
  }
  </code></pre>
  
  <p>Views:</p>
  
  <p>Main index.cshtml:</p>
  
  <pre><code>@model ViewModelBinding.Models.ProductIndexViewModel
  
  @using (@Html.BeginForm())
  {
  &lt;div&gt;
      @Html.LabelFor(model =&gt; model.NewProduct.Name)
      @Html.EditorFor(model =&gt; model.NewProduct.Name)
  &lt;/div&gt;
  &lt;div&gt;
      @Html.LabelFor(model =&gt; model.NewProduct.Price)
      @Html.EditorFor(model =&gt; model.NewProduct.Price)
  &lt;/div&gt;
  
  @Html.Partial("_Product", Model.Products)
  
  &lt;div&gt;
      &lt;input type="submit" value="Add Product" /&gt;
  &lt;/div&gt;
  }
  </code></pre>
  
  <p>Parial View _Product.cshtml:</p>
  
  <pre><code>@model List&lt;ViewModelBinding.Models.Product&gt;
  
  @for (int count = 0; count &lt; Model.Count; count++)
  { 
      &lt;div&gt;
      @Html.LabelFor(model =&gt; model[count].ID)
      @Html.EditorFor(model =&gt; model[count].ID)
      &lt;/div&gt;
      &lt;div&gt;
      @Html.LabelFor(model =&gt; model[count].Name)
      @Html.EditorFor(model =&gt; model[count].Name)
      &lt;/div&gt;
      &lt;div&gt;
      @Html.LabelFor(model =&gt; model[count].Price)
      @Html.EditorFor(model =&gt; model[count].Price)
      &lt;/div&gt;
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          BoringStoreContext db = new BoringStoreContext();
          ProductIndexViewModel viewModel = new ProductIndexViewModel
          {
              NewProduct = new Product(),
              Products = db.Products
          };
          return View(viewModel);
      }
  
      [HttpPost]
      public ActionResult Index(ProductIndexViewModel viewModel)
      {
          // work with view model
  
          return View();
      }
  </code></pre>
  
  <p>}</p>