, . :
:
public class Book
{
public string Name { get; set; }
}
public class Author
{
public string Name { get; set; }
}
:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(List<Book> books, List<Author> authors)
{
return View();
}
}
:
<% using (Html.BeginForm()) { %>
<input type="text" name="books[0].Name" value="book 1" />
<input type="text" name="books[1].Name" value="book 2" />
<input type="text" name="authors[0].Name" value="author 1" />
<input type="text" name="authors[1].Name" value="author 2" />
<input type="submit" value="OK" />
<% } %>
POST.
UPDATE:
, ASP.NET MVC 3 RC2, RTM. Application_Start:
ModelMetadataProviders.Current = new DataAnnotationsModelMetadataProvider();