3
<asp:CustomValidator ID="CustomValidator1" runat="server" 
    ErrorMessage="Date must be set" ClientValidationFunction="ValidateDate" 
    ControlToValidate="DropDownList1" Display="Dynamic" class="errorMessage">
</asp:CustomValidator>

This is the custom validator, the client-side function is called ValidateDate.

function ValidateDate(sender, args) {
    args.isValid = false;
}

I wrote this function both in a separate .js file, and in the .aspx file, yet it's not working.

Of course the validation will be bigger, I'm just making a test.

1
  • Mind the case sensitivity. Client-side validator should be set like: args.IsValid = false; Commented Mar 17, 2015 at 16:26

1 Answer 1

7

You have to set ValidateEmptyText="True|False"property on your validator to validate empty text. MSDN

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.