Disable validation on certain fields

Posted by adriaanp on Stack Overflow See other posts from Stack Overflow or by adriaanp
Published on 2010-03-25T21:32:15Z Indexed on 2010/03/25 21:33 UTC
Read the original article Hit count: 295

Filed under:
|

I've got a ViewModel for adding a user with properties: Email, Password, ConfirmPassword with Required attribute on all properties. When editing a user I want the Password and ConfirmPassword properties not to be required.

Is there a way to disable validation for certain properties in different controller actions, or is it just best to create a seperate EditViewModel?

© Stack Overflow or respective owner

Related posts about validation

Related posts about asp.net-mvc