CustomValidator and Radiobuttonlist

Modified on 2008/11/20 18:31 by Administrator — Categorized as: ASP_net

I had a lot of trouble getting my CustomValidator events to fire on a radiobuttonlist until I figured out that they needed to have ValidateEmptyText="true" in order to be invoked when nothing was selected.

Here's my complete CustomValidator:

<asp:CustomValidator ID="custvalBirthCenters" runat="server" ControlToValidate="rbBirthCenters"
    ValidationGroup="DoulaProfile" OnServerValidate="ValidateBirthCenters"
    ErrorMessage="Please indicate whether you attend births at birth centers."
    Display="Dynamic" Text="*" CssClass="validation" Enabled="true" ValidateEmptyText="true" ></asp:CustomValidator>

Other things to check if it isn't firing: