I have a model, EventSearch defined and I'm stumped on how to create a validator that will require at least one field to be filled for the model to be considered valid. It seems to me this will either be a model annotation or I could annotate each property as belonging to a group of "Require At Least One". Anybody run into this before?
Check out these links on how to create custom data annotations by extending from the ValidationAttribute class:
Custom model validation of dependent properties using Data Annotations
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.