KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Im working on a big MVC3 web application and have an annoyance regarding the ModelState.IsValid method. ModelState is being used in nearly all of my controllers so to validate the data being posted. The views are all based on ViewModels which contain different classes and these classes obviously contain properties which could be marked as [Required] . The problem i am having is the required properties are sometimes not required and im having to use the ModelState.Remove method so that ModelState.IsValid becomes true. My question is by using ModelState.Remove , is this the correct way of doing things or is there a more efficient approach.
Tags (comma-separated)
Save Edits
Cancel