CustomValidator
Working with CustomValidator
The CustomValidator control calls a user-defined function to perform validations that the standard
validators can't handle. The custom function can execute on the server or in client-side script, such as JScript
or VBScript. For client-side custom validation, the name of the custom function must be identified in the
ClientValidationFunction property. The custom function must have the form
function myvalidator(source, arguments)
Note that
source is the client-side
CustomValidator object, and
arguments is an object with two properties,
Value and
IsValid. The
Value property is the value to be validated and the
IsValid property is a
Boolean used to set the return result of the validation. You can view a client-side validation example in the
ASP.NET Validation
section.
For server-side custom validation, place your custom validation in the validator's OnServerValidate delegate.
The following sample illustrates using the CustomValidator control.
Copyright 2001 Microsoft Corporation. All rights reserved.