Username: Save?
Password:
Home Forum Links Search Login Register*
    News: Welcome to the TechnoWorldInc! Community!
Recent Updates
[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 24, 2024, 11:48:22 AM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[April 03, 2024, 06:11:00 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[March 06, 2024, 02:45:27 PM]

[February 14, 2024, 02:00:39 PM]
Subscriptions
Get Latest Tech Updates For Free!
Resources
   Travelikers
   Funistan
   PrettyGalz
   Techlap
   FreeThemes
   Videsta
   Glamistan
   BachatMela
   GlamGalz
   Techzug
   Vidsage
   Funzug
   WorldHostInc
   Funfani
   FilmyMama
   Uploaded.Tech
   MegaPixelShop
   Netens
   Funotic
   FreeJobsInc
   FilesPark
Participate in the fastest growing Technical Encyclopedia! This website is 100% Free. Please register or login using the login box above if you have already registered. You will need to be logged in to reply, make new topics and to access all the areas. Registration is free! Click Here To Register.
+ Techno World Inc - The Best Technical Encyclopedia Online! » Forum » THE TECHNO CLUB [ TECHNOWORLDINC.COM ] » Programming Zone » ASP .NET
 Understanding ASP.NET Validation Controls
Pages: [1]   Go Down
  Print  
Author Topic: Understanding ASP.NET Validation Controls  (Read 2646 times)
Daniel Franklin
TWI Hero
**********


Karma: 3
Offline Offline

Posts: 16647


View Profile Email
Understanding ASP.NET Validation Controls
« Posted: September 29, 2007, 10:01:31 AM »


In HTML you can perform validation either by checking the values at client-side or after submitting the form at the server-side. But these methods in HTML take lots of time to create and maintain the code. Moreover, if the user has disabled JavaScript then he or she may not receive the message regarding the error.

Therefore, in ASP.NET you can use ASP.NET Validation Controls while creating the form and specify what ASP.NET Validation Controls you want to use and to which server control you want bind this. ASP.NET Validation Controls are derived from a common base class and share a common set of properties and methods. You just have to drag and drop the ASP.NET Validation Control in the web form and write one line of code to describe its functionality.

This reduces the developer time from writing JavaScript for each type of validation. Moreover, through ASP.NET Validation Controls if any invalid data is entered the browser itself detects the error on the client side and displays the error without requesting the server. This is another advantage because it reduces the server load.

The five types of ASP.NET Validation Controls in ASP.NET Framework include:

• RequiredField Validation control: prompts message if any input field is left blank. This validation control can also be used to prompt message to the user if he or she has left any input field with its default value.


• Range Validation control: Prompts message to the user, if the data entered in the input field is not within the range of the values specified by the Maximum and Minimum properties of the validation control.

• Comparison Validation control: Allows the user to compare two values and check for comparisons such as equality, greater-than, less-than etc. In addition you can check whether the data entered in the input field is of the data type as specified by you.

• RegularExpression Validation control: Allows you to validate if the format of a certain input field is correct or not. You can check the validation of the commonly performed formats such as social security numbers, e-mail addresses, telephone numbers, and postal code.

• Custom Validation control: Allows you to define your own condition for validating the data in the input fields. Two validation functions can be performed using Custom Validation control: first on the server-side and second on the client-side. These functions contain logic defined by you to validate the input fields. These functions returns the True value and False value, if the condition you specified is correct or not respectively.

If the control's value does not validate to what you have specified in the validation control tag, the web form displays an error message. Moreover, you can customize the format of the error message by using the control properties such as BackColor, BorderStyle, and BorderWidth. In addition, you can use Cascading Style Sheet (CSS) to format an error message.

To access online version of the above article, please go to http://www.dotnet-guide.com/validation.html

Articles Source - Free Articles

Logged

Pages: [1]   Go Up
  Print  
 
Jump to:  

Copyright © 2006-2023 TechnoWorldInc.com. All Rights Reserved. Privacy Policy | Disclaimer
Page created in 0.141 seconds with 24 queries.