Macros
Macros

Reputation: 7119

MVC ModelState not updating

I have a view model, which I have described in a previous question: ASP.net MVC Validation on mutiple controls

My controller action that handles the form post has the field DOB correctly populated however my ModelState object does not thereby causing the validation (which is 'Required') to fail. In here, DOB is null. I have tried outputting DOB as a hidden field in my view however this has not fixed the issue. Is there a proper way to achieve this or could I just edit the ModelState before calling IsValid?

Upvotes: 0

Views: 253

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038730

You may find the following blog post helpful.

Upvotes: 1

Related Questions