validator for 2 fields?

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?
 
A

Aidy

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top