Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   RequiredFieldValidator not working with RadioButtonList (http://www.velocityreviews.com/forums/t776271-requiredfieldvalidator-not-working-with-radiobuttonlist.html)

shodson@gmail.com 06-10-2005 01:06 AM

RequiredFieldValidator not working with RadioButtonList
 
I have the following code

What's your sport?
<asp:RadioButtonList ID="rblSport" Runat="server">
<asp:ListItem Value="golf">Golf</asp:ListItem>
<asp:ListItem Value="base">Baseball</asp:ListItem>
<asp:ListItem Value="soft">Softball</asp:ListItem>
<asp:ListItem Value="swim">Swimming</asp:ListItem>
<asp:ListItem Value="jfw">Just for Women</asp:ListItem>
</asp:RadioButtonList>
<asp:RequiredFieldValidator ID="reqSport" Runat="server"
ControlToValidate="rblSport" InitialValue="" Display="Static" Text="*"
ErrorMessage="Please select the sport you play" />

So if the user submits this form, and they have not selected a sport,
I'd expect the validator to catch it but it's not.

How can I get my validator to ensure that one of the sport radio
buttons are selected?

I'm using .NET 1.1 on XP Pro SP1


shodson@gmail.com 06-10-2005 01:28 AM

Re: RequiredFieldValidator not working with RadioButtonList
 
Never mind, this works, I just wasn't checking for Page.IsValid on the
button click event...



All times are GMT. The time now is 05:21 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.