Custom Validator with an OR Condition

Posted by zSysop on Stack Overflow See other posts from Stack Overflow or by zSysop
Published on 2009-07-01T17:17:24Z Indexed on 2010/04/03 12:03 UTC
Read the original article Hit count: 313

Filed under:
|
|

Hi all,

Right now i have an asp.net 2.0 app which allows a user to search by the following fields

Location (Required if there is nothing in idnumber field)
Address  (Required if there is nothing in idnumber field)
Zip      (Required if there is nothing in idnumber field)

**OR**

IDNumber. (Required if there is nothing in any of the other fields)

What i'd like to be able to do is validate this client side on button click and display a summary of errors.

i.e. if a user leaves every criteria blank. I'd like to display "You must enter a IDNumber or "Location, Address, and Zip to continue"

I've never used the Custom Validation control so here are some questions. 1) Is it able to do this? 2) Does anyone have an example of how to do this?

Thanks

© Stack Overflow or respective owner

Related posts about asp.net-2.0

Related posts about custom