You can specify the pattern for Regular Expression Validator using Validation Expression property. NET 2.0 provides predefined set of universal patterns (Regular Expressions) to choose from through Regular Expression Editor.To see Regular Expression Editor in action, switch to Design mode.Validation is a set of rules that you apply to the data you collect.In this way, we can bring certain degree of discipline in end user.You can throw appropriate error message if the validation fails.
So, Validation server controls offer the combined power of both approaches such that the security of application is never compromised. To make this happen, simply set the Cause Validation property to True for submit button as shown below The Required Field Validator control is simple validation control which checks to see if the data is entered for the attached control.You can see below given Regular Expression Editor window Sometimes, predefined Validation controls cannot address some of our critical requirements. This is where the Custom Validator control comes into play.The Custom Validator control allows you to build your own client-side or server-side validations that can then be easily applied to your web forms.You can see that Enter password textbox value is matched against Confirm Password textbox values to make sure that they match.If they don't match in their values, you can display error message by setting Error Message property as shown above.Similarly, you can use Initial Value property to control the initial value of attached control.