validator for 2 fields?

  • Thread starter Thread starter HockeyFan
  • Start date Start date
H

HockeyFan

Is there good way to set up a validator on 2 textboxes, so that at
least one of the two has to have something besides blanks? One
approach I thought about was to create a hidden field and use
javascript to update that field from either of the 2 textboxes, and
then set the validator on that one field. However, I don't really
like this approach and would like to see another way of doing it.

If nothing else, will I have to catch this in the codebehind, and if
so, what's the best approach for notifying that user that one of those
2 fields needs to be filled in?
 
Validators are only good for validating one control (unless they've revamped
them in 2.0). If you need a control that governs two then just code it up
yourself.
 
Understood. I've coded validations before but was really wanting to know
what other people do when they have to validate to make sure that at least
one of 2 controls contain data. I was wondering if someone had come up with
an elegant solution.
 
Back
Top