RequiredFieldValidator not working with RadioButtonList

Discussion in 'ASP .Net Web Controls' started by shodson@gmail.com, Jun 10, 2005.

  1. Guest

    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
    , Jun 10, 2005
    #1
    1. Advertising

  2. Guest

    Never mind, this works, I just wasn't checking for Page.IsValid on the
    button click event...
    , Jun 10, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob
    Replies:
    4
    Views:
    500
    bruce barker
    Jul 18, 2003
  2. D. Shane Fowlkes
    Replies:
    2
    Views:
    5,917
    Martin Dechev
    Feb 23, 2004
  3. Roni Burd
    Replies:
    6
    Views:
    2,397
    Roni Burd
    Jul 3, 2004
  4. Marcio Kleemann

    RequiredFieldValidator not working

    Marcio Kleemann, Aug 12, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    2,528
    Marcio Kleemann
    Aug 12, 2004
  5. Ferret Face
    Replies:
    1
    Views:
    3,064
    Tim Cartwright
    Nov 10, 2005
Loading...

Share This Page