What is a RequiredFieldValidator control?

The RequiredFieldValidator is a control that checks whether the value of an assigned input control is different from its initial value.

To work with this control drag a RequiredFieldValidator control, Command Button and two TextBoxes from the Toolbox. The intention is to display the text entered in TextBox1 in TextBox2 when the Command Button is clicked. If there is no value in TextBox1, an error message ("Saying Textbox1 needs a value") will be spawned.

All you have to make the RequiredFieldValidator work is to open the properties of the control. Looking at two properties; ErrorMessage and ControltoValidate specifically. The ErrorMessage property should be completed with a warning that the field needs to be completed. Secondly, the ControltoValidate property is used to tag which control is to be validated.

The sample code for that is:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal_
                                    e As System.EventArgs) Handles Button1.Click
TextBox2.Text = TextBox1.Text
End Sub


Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com

Index

 
Printer friendly version of the FAQ-ASPNET-Required-Validator-Control page


Sponsored links

Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
ASP.NET 3.5 Hosting on Windows 2008!
ASP.NET 3.5/2.0 Hosting on Windows 2008 & 2003! AJAX, LINQ, & Silverlight Ready! 3 Mo. Free!!
SFTP components for .NET
Add complete SSH and SFTP support to your .NET framework application
PureCM Software Configuration Management
Version control and integrated issue tracking - powerful and easy to use. Get your FREE trial now!
Virtual File System SDK
Create your own file systems in Windows and .NET applications

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.