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...

Advertisement
Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 373 | Hits: 18

Similar Posts

  • SharePoint 2010 Workflow more
  • EF4: Lazy Loading on By Default but what about pre Beta 2 Models? more
  • Spec Explorer: A Model-Based Testing tool more
  • LINQ to SQL, Lazy Loading and Prefetching more
  • "Oslo" at the 2009 PDC more
  • What needed to be monitored to get better Governance more
  • ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities more
  • Getting Loopy (Matt Gertz) more
  • Silverlight, MVVM, Prism and More at VSLive Orlando more
  • Twilight 1.5: Multiple Views with MVVM more

News Categories

.NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD