|
Subject:
|
how do I validate a radio button group
|
|
Posted By:
|
whyulil
|
Post Date:
|
1/10/2007 6:06:10 AM
|
Hi everybody, Im coming back to a spot of ASP.NET after a long break and ive already come up across a problem. Doh!
I need to check that the user has selected eith Male or Female from a radio button group before a form is submitted.
<asp:radioButton id="sexm" runat="server" groupname="sex" /> male
<asp:radioButton id="sexf" runat="server" groupname="sex" /> female
Im assuming i need to use a custom validation control to check if either of them is true. If so what do i set the controlToValidate attribute to? Is this correct or is there a built in control for this sort of thing? Is there a tutorial anybody can recommend.
Thanks for your time Andy
|
|
Reply By:
|
whyulil
|
Reply Date:
|
1/10/2007 9:44:48 AM
|
changed the way i did it to use a radioButtonList, then validated the radioButtonList control with a requiredFieldValidator. I knew it shouldn't be that much effort! still dont like the sloppy html output of asp.net 2.0, i was led to believe it was much nicer to work with :(
|