RequiredFieldValidator 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 RequiredFieldvalidator in asp .net. We can use required field validator to ensure that user cannot enter blank data.
 
 Step1: Create TextBox control, Validation Control and Button.
 Step2: Use ErrorMessage property of RequiredFieldValidator and enter message you want to display.
 Step3: Use ControlToValidate property of RequiredFieldValidator and enter id of TextBox which you want to validate.
 Step4: Use ForeColor property of RequiredFieldValidator and enter name of the color you want to use.
 
 
Enter Your Name

 

Final Output:

 
Best quality Asp .Net Ajax Control Toolkit tutorials.
how to use validators in c#.net?
5-Feb-2014 From  yamunaZ
Hi yamunaZ this example is created using asp .net and C#. You can use these validators in both c# and VB .Net.
9-Feb-2014 From  Anuj
coding super sir
20-Dec-2014 From  vijay
You example will be always easy
29-Sep-2021 From  Jeel

Give your valuable comments.

Name
Email
Comment
6 + 4 =
 

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