RegularExpressionValidator Example in asp .net

 Validations are the most important part of websites and software. By using validations we can restrict users to enter any Invalid data into your database. There are many validation techniques available do validate form data like JQUERY validations, server side validations. In Asp .Net microsoft has provided us great validation controls. In this series of articles we will explore validation controls provided by microsoft. 

 
In this article we will see how to use RegularExpressionValidator in asp .net. We can use RegularExpressionValidator field validator to ensure that user has entered data in correct format. Here we will check that wether user is entering correct email address or not(We can only check email format).
 
Previous article from the series:
 
Step1: Create TextBox control, RegularExpressionValidator Control and Button.
Step2: Use ErrorMessage property of RegularExpressionValidator and enter message you want to display.
Step3: Use ControlToValidate property of RegularExpressionValidator and enter id of TextBox which you want to validate.
Step4: Use ValidationExpression property of RegularExpressionValidator and enter regex to validate email format. For this you can go to properties of RegularExpressionValidator and select ValidationExpression from dropdown.
Step5: Use ForeColor property of RegularExpressionValidator and enter name of the color you want to use.
 
Enter Your Email
 
Final Output:
RegularExpression-Example-Anuj-Koundal-CodingFusion
 
Best quality Asp .Net Ajax Control Toolkit tutorials.
Thanks Solved my problem.
23-Sep-2013 From  Anand

Give your valuable comments.

Name
Email
Comment
4 + 5 =
 

About Us | Terms of Use | Privacy Policy | Disclaimer | Contact Us Copyright © 2012-2024 CodingFusion
50+ C# Programs for beginners to practice