Home / ASP.NET Weblogs

Latest Microsoft Blogs

Browse by Tags

Related Posts

  • Model Binding To A List

    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! It’s really easy if you’re 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 have the same name. For example, here’s an example of a form that would bind to this, assuming you keep each value a proper integer. < form method ="post" action ="/Home/UpdateInts" > < input type ="text" name ="ints"...


Page 1 of 1 (1 items)

Archives