Run VB Subroutine When Compare Validator Fails

38 Views Asked by At

I have the following compare validator below. When this validator fails I want to be able to run a subroutine in order to hide some panels that may be displayed at the time of failure.

Is there something similar to a Custom Validator's OnServerValidate method that I could use for a compare validator?

<asp:CompareValidator runat="server" ID="cvStudentDOB" ControlToValidate="tbBirthDate" Operator="DataTypeCheck" Type="Date" ValidationGroup="StudentBirthDate" ErrorMessage="DOB must be a valid date." ForeColor="White" Text="*"></asp:CompareValidator>
1

There are 1 best solutions below

0
wolfeh On

On the button click

if not page.isvlaid then
  if cvStudentDOB.isvalid = false then

  'Run sub to hide panels.
  end if
end if