You can validate the following server controls: Text Box, List Box, Drop Down List, Radio Button List, and the following HTML controls: Html Input Text, Html Input File, Html Select, and Html Text Area.
We have seen the Required Field Validator in our first sample program, let’s move on to examine the rest of the controls.
Validation occurs when a user clicks any Button control by default, but you can change this behavior by setting the Causes Validation property to false. Whenever the user presses a button on the form, the script executes the validation checks for each validation control on the form.
As we will see later in the code-behind file, the Cancel Button will clear all of the fields on the form, and we do not want to validate any of the fields when the user presses this button. If any one of the validation controls on a form fails, the script cancels the postback operation and displays error messages on the form.
All of the validation controls derive from the Base Validator class, giving them common methods and properties.
As we mentioned earlier, validation controls execute when the user clicks a Button control, including HTML button controls and server button controls such as the Link Button and Image Button.
In the Properties dialog box find the Control To Validate property and select First Name Text Box from the drop down list. We can set other properties, such as the Error Message property, and the final ASPX source code should look like the following. NET work in a similar fashion to what we've seen above. If the client's web browser is of executing client side Java Script, the first validation pass occurs on the client.