MVC 3 - parse FormCollection to model
For my sample application I am building I am currently 开发者_JAVA技巧forced to pass a FormCollection object into my action method when attempting to do ajax updates on my view.
The reason I have chosen to pass FormCollection is that my view is rather complex and contains nested collections. If I were to Serialize and Json.Stringify it drops these nested collections when passed into my action method.
Is there a good technique to map my FormCollection object to an instance of my ViewModel once inside the controller ?
thanks
You can use TryUpdateModel<TypeOfYourModel>(YourModelInstance)
精彩评论