www.acropetal.com vijayalakshmi g m validation controls

32
www.acropetal.com Vijayalakshmi G M Validation Validation Controls Controls

Upload: amberlynn-george

Post on 19-Jan-2016

226 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Www.acropetal.com Vijayalakshmi G M Validation Controls

www.acropetal.com

Vijayalakshmi G M

Validation ControlsValidation Controls

Page 2: Www.acropetal.com Vijayalakshmi G M Validation Controls

ContentsASP.Net Validation Controls OverviewTypes of Validation Controls

Page 3: Www.acropetal.com Vijayalakshmi G M Validation Controls

ASP.Net Validation Controls - Introduction

Page 4: Www.acropetal.com Vijayalakshmi G M Validation Controls

Validation Controls - Introduction Validates User input data. It can test for

Missing valuesComparison valuesValues within a range

Ensures that proper data is supplied to processing scripts.

Associated with TextBox control. Automatically performance the test when the

Button, LinkButton, or ImageButton controls are clicked.

Page 5: Www.acropetal.com Vijayalakshmi G M Validation Controls

Validation ControlsWhen the validation test fails it displays the

error message to the user.User can reenter the value in the text box.

Page 6: Www.acropetal.com Vijayalakshmi G M Validation Controls

ASP.Net Validation Controls

1. RequiredFieldValidator2. RangeValidator3. CompareValidator4. RegularExpressionValidator5. CustomValidator6. ValidationSummary

Page 7: Www.acropetal.com Vijayalakshmi G M Validation Controls

ASP.Net Validation Controls

Page 8: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:RequiredFieldValidator> Control Tests the textbox for the missing value and displays

an error message when value is not found Used to Check the Mandatory Fields in the Web

Forms. General format

Page 9: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:RequiredFieldValidator> - Properties

Property Description

ControlToValidate Gives the id of the textbox to be validated.

ErrorMessage It provides text for the error message.

SetFocusOnErrorMessage

Places the cursor in the associated text box.

ValidationGroup Identifies a grouping of TextBox controls to which a set of validation tests applies

Page 10: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:RequiredFieldValidator>

Note:It occupies horizontal space on the page equal to

the length of the error message. The space is preallocated to display the messages.When Display=“Dynamic” property is set the

message space is not preallocated and it will be dynamically set.

Page 11: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:RequiredFieldValidator>

Page 12: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:RangeValidator> Control Tests the value within the range of the value. Values data types

1. Currency (with a dollar sign and commas)2. Date3. Double (floating-point)4. Integer5. String (default).

Page 13: Www.acropetal.com Vijayalakshmi G M Validation Controls

RangeValidator – General Format

Page 14: Www.acropetal.com Vijayalakshmi G M Validation Controls

RangeValidator - Properties

1. ControlToValidate 2. ErrorMessage 3. SetFocusOnErrorMessage 4. ValidationGroup Note: Same as RequiredFieldValidator Control1. Type – It specifies the data type.2. MinimumValue – Sets the minimum value 3. MaximumValue – Sets the Maximum value

Page 15: Www.acropetal.com Vijayalakshmi G M Validation Controls

RangeValidator

Page 16: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CompareValidator> Compares the given value against a predefined value

based on the comparison operation selected by the user.

The test can be made for the values with following data types.1. Currency (with a dollar sign and commas)2. Date3. Double (floating-point)4. Integer5. String (default).

Page 17: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CompareValidator>

Page 18: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CompareValidator>

Property DescriptionOperator Sets the comparison operator.

Value To Compare

It is used to set the target value to be tested.

Page 19: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CompareValidator>

Page 20: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CustomValidator> Control This control is used to perform the

additional test (Which cannot performed when used in combinations).

General Format

Page 21: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CustomValidator> - Properties Basic properties are similar to the

RequiredFieldValidator Control.

Property DescriptionIsValid Set to false to indicate the failure of

the Validation TestOnServerValidate

It calls a subprogram to perform explicitly coded tests. The called subprogram takes the special ServerValidateEventArgs argument.

Page 22: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:CustomValidator> - Properties

Page 23: Www.acropetal.com Vijayalakshmi G M Validation Controls

Regular Expression Validator

Used to validate complex expressions.The expressions can be

phone numberemail addresszip code and many more.

Set the ValidationExpression property to any type of expression OR

Create the custom expression to validate the data.

Page 24: Www.acropetal.com Vijayalakshmi G M Validation Controls

Regular Expression Validator

Page 25: Www.acropetal.com Vijayalakshmi G M Validation Controls

Regular Expression Validator

Page 26: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:ValidationSummary>

The individual error messages generated by separate controls can be displayed together.

It can limit its error reporting to an identified set of grouped controls.

Page 27: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:ValidationSummary> General Format

Example

Page 28: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:ValidationSummary>

DisplayMode – Sets the display mode for the of the error summary.

ShowMessageBox – Display the error messages in the form of a message box.

ShowSummary – It suppresses the display of the error message on the page.

Page 29: Www.acropetal.com Vijayalakshmi G M Validation Controls

<asp:ValidationSummary>

Page 30: Www.acropetal.com Vijayalakshmi G M Validation Controls

Resource

Page 32: Www.acropetal.com Vijayalakshmi G M Validation Controls

Thank You