In accordance with this article, I am trying to link a list of unclassified items.
View:
<%using (Html.BeginForm("Products", "Home", FormMethod.Post)) { %> <input type="hidden" name="products.Index" value="cold" /> <input type="text" name="products[cold].Name" value="Beer" /> <input type="text" name="products[cold].Price" value="7.32" /> <input type="hidden" name="products.Index" value="123" /> <input type="text" name="products[123].Name" value="Chips" /> <input type="text" name="products[123].Price" value="2.23" /> <input type="hidden" name="products.Index" value="caliente" /> <input type="text" name="products[caliente].Name" value="Salsa" /> <input type="text" name="products[caliente].Price" value="1.23" /> <input type="submit" value="Submit" /> <%} %>
Action method:
[AcceptVerbs(HttpVerbs.Post)] public ActionResult Products(IList<Product> products) { return View("Index"); }
Binding does not work for me, parameter products always contain zero. Did I miss something?
Any help is greatly appreciated, thanks.
Please note that I am using ASP.NET MVC 1.0
Lamps Oct 18 '11 at 12:22 2011-10-18 12:22
source share