I have an MVC form in which there are two fields - One for Mobile number and another for Landline Number. Either of the fields should have values. Need to perform validation using data annotation. Using required property both will be mandatory. So just want to make only one mandatory( user can put both the numbers, atleast one is inputted)
Asked
Active
Viewed 21 times
0
-
1Possible Duplicate? https://stackoverflow.com/questions/2712511/data-annotations-for-validation-at-least-one-required-field – Jdog Jul 23 '20 at 15:25
-
Does this answer your question? [Data Annotations for validation, at least one required field?](https://stackoverflow.com/questions/2712511/data-annotations-for-validation-at-least-one-required-field) – Abdul Haseeb Jul 24 '20 at 11:03
-
use IValidatableObject to have it configured inside viewmodel class – MatR Jul 24 '20 at 12:05