Custom validation problem with Radiobuttonlist

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stoogots2
    New Member
    • Sep 2007
    • 77

    Custom validation problem with Radiobuttonlist

    This is a strange one. My custom validator function is executing onclick (or onclientclick) of my radiobuttonlist , instead of when I click on my submit button. Autopostback is set to false, so I'm extremely confused. When I run the app and click on one of the status list items, it is calling the executing the ValidateRBLStat us javascript method (I have a breakpoint set in VS2008).

    Code:
                <asp:RadioButtonList ID="rblStatus" runat="server" RepeatDirection="Vertical" RepeatColumns="1" AutoPostBack="false">
                <asp:ListItem Text="1" Value="1"></asp:ListItem>
                <asp:ListItem Text="2" Value="2"></asp:ListItem>
                <asp:ListItem Text="3" Value="3"></asp:ListItem>
                </asp:RadioButtonList>
    
    			<asp:CustomValidator ID="rfvStatus" runat="server" EnableClientScript="true" ControlToValidate="rblStatus" ErrorMessage="This field is required." 
                ClientValidationFunction="ValidateRBLStatus" Display="Dynamic"></asp:CustomValidator>
    <asp:TextBox ID="tbC" runat="server"></asp:TextBox><br />
                <asp:CustomValidator ID="rfvCitizenshipCountry" runat="server" 
                EnableClientScript="true" ControlToValidate="tbC" ErrorMessage="This field is required." ClientValidationFunction="ValidatetbC" Display="Dynamic"></asp:CustomValidator>
  • mzmishra
    Recognized Expert Contributor
    • Aug 2007
    • 390

    #2
    remove ControlToValida te="rblStatus" see if there is any change.

    Comment

    Working...