Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 10th, 2007, 07:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default how do I validate a radio button group

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.

Code:
<asp:radioButton id="sexm" runat="server" groupname="************" /> male
<asp:radioButton id="sexf" runat="server" groupname="************" /> 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
 
Old January 10th, 2007, 10:44 AM
Authorized User
 
Join Date: Jun 2003
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 :(





Similar Threads
Thread Thread Starter Forum Replies Last Post
Radio button gaurisharya C# 2005 2 March 16th, 2008 06:43 AM
Group name for radio buttons in Grid view nitinp ASP.NET 2.0 Professional 0 February 27th, 2007 07:15 AM
Validating group of radio buttons. rupen Javascript How-To 1 September 18th, 2006 02:44 AM
Radio Button hoailing22 ASP.NET 1.0 and 1.1 Basics 1 June 2nd, 2005 12:08 AM
Button acts depending on radio button values janise Access 4 March 10th, 2004 12:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.