I am using MVC2.
I have a 'Person View' that is bound to a 'Person model' that contains a 'Car Partial View' which is bound to a 'Car model'. The Person and the Car model are not related in any way nor do I want to create a new ViewModel for the Person View that contains the Person and Car model (I want the page to be dynamic and at runtime I decide if I need the Car Partial View. I may also in the future want to add more partial views to the Person View such as Hobbies, Social Networks, etc... so I don't want to keep extending the Person ViewModel)
The Car Partial View sits inside the Person's View BeginForm() and what I want to do is on submit of the Person View validate the Person Model and the Car Model and then return any errors via the ModelState.
The problem I have is that the ModelState only knows about the Person model and not the Car model.
Can anyone suggest how I can ensure on Submit that the ModelState of the Person and Car are validated? Do I need to add a HttpPost ActionResult to the Car View's controller to do the validation, if so when would this be executed? Which ModelState do I update, the Person or the Car?
If you need anymore clarification please ask...
Thanks in advance
View Complete Post