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
views:
295answers:
2
+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
2009-10-02 18:43:56
A:
Use bindingContext.ValueProvider (and bindingContext.ValueProvider.TryGetValue, etc.) to get values directly.
Craig Stuntz
2009-10-02 18:47:38