Validation Control

  • Uploaded by: Justin Cook
  • 0
  • 0
  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Validation Control as PDF for free.

More details

  • Words: 449
  • Pages: 10
To perform validations it requires validation controls. Web server controls do not have event support to perform validations at the client side. This can be achieved by using validation controls. The main advantage of the validation control is, it reduces burden from programmer so that application development will be faster.

REQUIRED FIELD VALIDATOR It will not allow text box to be left blank. When client sends a request to the web page, if the web page is having validation control then the JavaScript file will be downloaded to the client machine. The required field validator will be converted to span tag in the client machine. This will make a call to subprogram available within

JavaScript file to validate textbox. This validation takes place at the client side. There will not be any performance issue, only the burden will be more in terms of downloading the JavaScript file. RANGE VALIDATOR This control is required to provide the range for the values of textboxes.

COMPARE VALIDATOR This control can be used for performing three types of validations. 1. Data type checking 2. Comparing one textbox value with constant using relational operator. 3. Comparing one textbox value with another textbox. REGULAR EXPRESSION VALIDATOR

When you want to validate textbox data towards a particular pattern, then regular expression validator is required. These four validation controls can be used to perform validation either at client side or server side, but in both the places it is not possible. To perform server side validation, Go to properties,

Enable client script false (true (by default)) But this is not advisable. CUSTOM VALIDATOR When the client requirement does not match with validation controls provided by the Microsoft then a custom function has to be provided by the developer, then we require custom validator.

E.g. when user wants to provide a textbox, which accept only even numbers then, the function should be written in JavaScript language in HTML view. <Script language = ”JavaScript”> Function checkeven (s, Args) If (Args. Value %2! =0) { Args.IsValid=false; } Else

{ Args.IsValid=true; } } Here Args.Value returns the textbox value. Args. IsValid indicates whether the validation is successful or not. If you want to present the error message within a dialog box, then isValid does not have any importance.

Validation summary control When you want to display the entire error message at one place, then we require validation summary control. It will provide more clarity into the web page. It will save the space on WebPages. When you provide the text property, then the error message will be displayed within validation summary control. When the WebPages have no space to display the

error details then approach towards dialog box.

Related Documents

Validation Control
June 2020 30
Validation
June 2020 20
Validation
June 2020 24
Method Validation
December 2019 28
Validation Expressions
November 2019 26

More Documents from ""