Quick Search
Advanced Search »

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:
  • Does the ValidationGroup value match in all 3 places: the submit button, the validator control, and the control to validate?
  • Does the submit button have CausesValidation=true

This site built on ScrewTurn Wiki version cool open source .NET wiki

Don't forget to tell all your pregnant friends about DoulaMatch and the BirthWatch Facebook app