2

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?

Jarrod Nettles
  • 6,193
  • 6
  • 28
  • 46

1 Answers1

1

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

Custom Validation Attribute MVC2

Community
  • 1
  • 1
Thomas Buckley
  • 5,836
  • 19
  • 62
  • 110