This article will help us to use the validation control to the maximum extent to serve our project needs.
Validator control will fire on blur By default, when we use validator control it will fire the validations on blur of the control.
If you are an developer for quite sometime then you will have a basic idea on these validation controls.
Not every time we can use these inbuilt validation controls as it is to serve our needs.
Refer the below code that sets a image as validation message, Conditional Validation with Validation Control Sometimes, when we build an input processing forms we might come across situations where we need to validate some controls based on some conditions.
For example, we can make a textbox to be required field only when a checkbox is checked or a dropdownlist value, etc. Read my code snippet Conditionally validating a textbox when a checkbox is checked in ASP.
Drag a Validation Summary control to the place where we need to display the error messages and set all the Validator control’s Display property to none.
Net Projects Validation is one of the indispensable parts of any projects we develop.
A practical example will be calling a validator that belongs to a different validation group from a button click that does not belong to that validation group. Is Valid property will hold the input form validation status in Is Valid property when you check in a event that does not belongs to that validation group but still it requires to pass the validations on that group.
Validations like checking uploading file size when we use File Upload control can be done on server side only or validations that depend on database can be done on server side only.
Here comes the use of On Server Validate event of Custom Validator which does a server side validation.