Using the CustomValidator Control
CustomValidator control provides the customize validation code to perform both client-side and server-side validation. For example, you can create a validation control that checks whether the value entered into a text box is 8 or more characters long. If none of the other validation controls perform the type of validation that you need, you can always use the CustomValidator control. The control allows you to validate both clientside and serverside, where the serverside approach is probably the most powerful. You can associate your custom validation function with the CustomValidator control by handling the ServerValidate event.
If you don't associate a client validation function with a CustomValidator control, then the CustomValidator doesn't render the error message until you post the page back to the server. Because the other validation controls prevent a page from being posted if the page contains any validation errors , you won't see the error message rendered by the CustomValidator control until you pass every other validation check in a page.