title: Add dynamic form content in MVC
body: <p>I'm trying to add dynamic content to my mvc application.</p>
  
  <p>I'm using Steven Sanderson post <a href="http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/" rel="nofollow">Editing a variable length list, ASP.NET MVC 2-style</a>, and thanks to it, I had some dynamic content into it.
  Due some constraints of my application, I had to make a change into base Gift class.</p>
  
  <p>The problem is that now the application doens't work.</p>
  
  <p><strong>In my Model I have:</strong></p>
  
  <pre><code>public class Gift
  {
      //public string Name { get; set; }
      //public double Price { get; set; }
  
      public List&lt;string&gt; MyList { get; set; }
  }
  </code></pre>
  
  <p>And now, I'm getting null values in gifts parameter</p>
  
  <pre><code>[HttpPost]
  public ActionResult Index(IEnumerable&lt;Gift&gt; gifts)
  {
      return View("Completed", gifts);
  }
  </code></pre>
  
  <p>Can anyone help me on this?</p>
  
  <p><strong>EDIT:</strong>
  Here is my View code:</p>
  
  <pre><code>&lt;%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage&lt;IEnumerable&lt;Enviro2011.Models.Gift&gt;&gt;" %&gt;
  
  &lt;asp:Content ContentPlaceHolderID="HeadContent" runat="server"&gt;
      &lt;link rel="Stylesheet" href="../../Content/styles.css" /&gt;
      &lt;script type="text/javascript"&gt;
          $(document).ready(function () {
  
              $("#addItem").click(function () {
                  $.ajax({
                      url: this.href,
                      cache: false,
                      success: function (html) { $("#editorRows").append(html); }
                  });
                  return false;
              });
  
              $("a.deleteRow").live("click", function () {
                  $(this).parents("div.editorRow:first").remove();
                  return false;
              });
          });
      &lt;/script&gt;
  &lt;/asp:Content&gt;
  &lt;asp:Content ContentPlaceHolderID="MainContent" runat="server"&gt;
      &lt;h2&gt;
          Gift List&lt;/h2&gt;
      What do you want for your birthday?
      &lt;% using (Html.BeginForm())
         { %&gt;
      &lt;div id="editorRows"&gt;
          &lt;% foreach (var item in Model)
                 Html.RenderPartial("GiftEditorRow", item);
          %&gt;
      &lt;/div&gt;
      &lt;%: Html.ActionLink("Add another...", "Add", null, new { id = "addItem" }) %&gt;
      &lt;input type="submit" value="Finished" /&gt;
      &lt;% } %&gt;
  &lt;/asp:Content&gt;
  </code></pre>
  
  <p><strong>Edit2</strong>
  I also have found out the post <a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx" rel="nofollow">Model Binding To A List</a> from Phil Haack, and works just fine, but I can't implement the feature 'Add Book' !!!</p>