Validation: Making sure a RadioButton is selected

N

Nathan Sokalski

I have a set of RadioButtons in my form. I want to make sure that the user
selects one of them, and therefore am initially having none of them
selected. However, I want an error message to be displayed if they attempt
to submit the form without selecting one of them the same way an error
message would be displayed by a RequiredFieldValidator or any of the other
validation controls. However, because the RadioButtons are separate
controls, I cannot use the CustomValidator because I cannot put more than
one control in the ControlToValidate property. Is there a way to use any of
the validation controls to achieve this? I would prefer to use a validation
control so that I can include the error in the ValidationSummary control.
Thanks.
 
C

CodeMeister

Use a RadioButtonList. Add you items to the list. Set the ControlToValidate
of your RequiredFieldValidator to the RadioButtonList.


IHTH

Jon
 

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

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top