formcollection

How can a formcollection be enumerated in ASP.NET MVC2

I was previously using http://stackoverflow.com/questions/762825/how-can-a-formcollection-be-enumerated-in-asp-net-mvc 's implementation but now I'm on VS2010 and MVC2 its complaining: Error 1 Cannot implicitly convert type 'System.Web.Mvc.IValueProvider' to 'System.Collections.Generic.IDictionary'. An explicit conversion exists...

MVC2 FormCollection options

I'm just getting started with MVC2 and going through the NerdDinner examples. I noticed that there seems to be multiple ways to pass in the form values for example: FormColelction formvalues FormCollection collection FormCollection form Why would you use one over the other and why? Does it also relate to whether you are using Entity ...

ASP.NET MVC2 - Trim of whitespace on all fields in a model?

Hi, I have data coming in and out of an ASP.NET MVC2 Controller/View set-up. Unfortunety, all data that comes from the view has MASSIVE amounts of whitespace at the end. I'm using the TryUpdateModel to save all form data to the Db after it passes validation, passing a FormCollection as a parameter(eg. form.toValueProvider). Is there ...

Understanding FormCollection.AllKeys.Contains

I'm looking at a code block and can't grok what's happening with the line - formValues.AllKeys.Contains("Email_" + i); it looks like an assignment should be taking place but... public ActionResult EditAdditionalLocations(int ID, int? count, FormCollection formValues) { ... for (int i = 0; i < _count; i++) { ...

Getting all selected checkboxes from a FormCollection

I have a form which contains a whole bunch of checkboxes and some other types of control too. I need to retrieve the names of each selected checkbox. What is the best way to do this? Can I do it with a linq query maybe? So in pseudocode, I'm looking to do something like this: var names = formCollection .Where(c => c is ...