Search code examples
asp.netcheckboxrequiredfieldvalidator

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


Solution

  • 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