title: MVC3 Remote Validation of a field within a List
body: <p>For some reason, whenever I try to remotely validate a primitive property inside an array within my model, the value of the property is not passed as a parameter.</p>
  
  <p>For example, when my remote validation method (UniqueItemNo) is called, the string parameter "id" is always null. If I were to perform validation on CartNumber instead of ItemNumber, the parameter is passed correctly.</p>
  
  <h2>Controller</h2>
  
  <pre><code>public class HomeController : Controller
  {
      public ActionResult Index()
      {
          CartModel cart = new CartModel();
          cart.Items.Add(new ItemModel() { ItemNumber = "12345" });
          return View(cart);
      }
  
      [HttpPost]
      public JsonResult UniqueItemNo(string id)
      {
          /** Do Work **/
          return null;
      }
  }
  </code></pre>
  
  <h2>Models</h2>
  
  <pre><code>public class ItemModel
  {
      [Remote("UniqueItemNo", "Home", HttpMethod="POST")]
      public string ItemNumber { get; set; }
  }
  
  public class CartModel
  {
      public CartModel()
      {
          Items = new List&lt;ItemModel&gt;();
      }
  
      public List&lt;ItemModel&gt; Items { get; set; }
      public string CartNumber { get; set; }
  }
  </code></pre>
  
  <h2>View</h2>
  
  <pre><code>@{
      ViewBag.Title = "Home Page";
  }
  
  &lt;h2&gt;@ViewBag.Message&lt;/h2&gt;
  @using(Html.BeginForm()) {
      &lt;p&gt;
          @for(int i = 0; i &lt; Model.Items.Count; i++)
          {
              @Html.TextBoxFor(m =&gt; m.Items[i].ItemNumber);
              @Html.ValidationMessageFor(m =&gt; m.Items[i].ItemNumber);                                    
          }
      &lt;/p&gt;
  }
  </code></pre>