Model Binding To A List
Posted by: youve been HAACKED,
on 24 Oct 2008 |
View original | NEW Bookmarked: 0 time(s)
Using the DefaultModelBinder in ASP.NET MVC Beta, you can bind submitted form values to arguments of an action method. But what if that argument is a list? Can you bind a posted form to an IList<T>? Sure thing! Its really easy if youre posting a bunch of simple types. For example, suppose you have the following action method. public ActionResult UpdateInts(IList<int> ints) {
return View(ints);
}
You can bind to that by simply submitting a bunch of form fields which each...