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.

4

1 に答える 1

7

ValidateEmptyText="True|False"空のテキストを検証するには、バリデーターにプロパティを設定する必要があります。MSDN

于 2012-12-16T15:43:52.983 に答える