I have the following model
public AccountInfo {
// loads of other property here as well.
public string Password { get; set; }
public string NewPassword { get; set; }
[Compare("NewPassword", ErrorMessage = "New Passwords dont match.")]
public string ConfirmNewPassword { get; set; }
}
I am using data annotations to display client side validation message.
Now I am working on the change user profile details page.
What I am required to do is, Along with the other details such as email, full name, address etc, I have to show 3 fields namely
- Current password
- New password
- Confirm New password
Now the scene is that these are optional fields and user may not fill it. But when he does, I want to make sure all the 3 fields are filled., if not I want to show some validation error using data annotation.
Any Thoughts ?