Wahtever
Wahtever

Reputation: 3678

using asp.net required field validator with two check boxes

i have two check boxes with male/female and i would like to add a required field validator for them so if none is checked then a custom error appears, i can already do this but with one control not two.

thanks

Upvotes: 4

Views: 6152

Answers (2)

Wahtever
Wahtever

Reputation: 3678

All I needed to do was instead of adding two separate CheckBoxs ,I needed to add a CheckBoxList:

CheckBoxList

and then use a normal RequiredFieldValidator on the CheckBoxList:

RequiredFieldValidator

Upvotes: 2

Stanley
Stanley

Reputation: 11

You'll need to use the CustomValidator with a ClientValidationFunction

http://forums.asp.net/t/1402179.aspx

  • or -

You'll need to write a custom control or use one that's already made:

-http://www.codeproject.com/KB/validation/MultiDependValidator.aspx

Upvotes: 1

Related Questions