In this example, we will simply check the length of the string in the TextBox. This is a very basic and that useful example, only made to show you how you may use the CustomValidator.
errormessage="The text must be exactly 8 characters long!"/>
As you can see, it’s pretty simple. The only unknown property is the onservervalidate event. It’s used to reference a method from CodeBehind which will handle the validation. Switch to our CodeBehind file and add the following method: