views:

295

answers:

2

I had a nice function that took my FormCollection (provided from the controller). Now I want to do a model bind instead and have my model binder call that function and it needs the FormCollection. For some reason I can find it. I thought it would have been controllerContext.HttpContext.Request.Form

+3  A: 

Try this:

var formCollection = new FormCollection(controllerContext.HttpContext.Request.Form)

FormCollection is a type we added to ASP.NET MVC that has its own ModelBinder. You can look at the code for FormCollectionBinderAttribute to see what I mean.

Haacked
A: 

Use bindingContext.ValueProvider (and bindingContext.ValueProvider.TryGetValue, etc.) to get values directly.

Craig Stuntz