Views: 105.3K
Replies: 1
Archived
|
Extract key/values from FormCollection in ASP.NET MVC action methodIt took me a while to find this out. To avoid you from having to chase for the same information: here's how you extract key / value pairs from the FormCollection that comes as an argument in an ASP.NET MVC action method:
public ActionResult Create(FormCollection formCollection) { foreach (var key in formCollection.AllKeys) { var value = formCollection[key]; // etc. } foreach (var key in formCollection.Keys) { var value = formCollection[key.ToString()]; // etc. } }
Christopher Ronny, Apr 18, 2010
|
|
Reply 1Nice and timely information. Exactly what I was looking for. +1 for you.
Juan Perez, Apr 19, 2010
|