Download presentation
Presentation is loading. Please wait.
Published byAmberlynn George Modified over 8 years ago
1
www.acropetal.com Vijayalakshmi G M Validation Controls
2
Contents ASP.Net Validation Controls Overview Types of Validation Controls
3
ASP.Net Validation Controls - Introduction
4
Validation Controls - Introduction Validates User input data. It can test for Missing values Comparison values Values 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.
5
Validation Controls When the validation test fails it displays the error message to the user. User can reenter the value in the text box.
6
ASP.Net Validation Controls 1.RequiredFieldValidator 2.RangeValidator 3.CompareValidator 4.RegularExpressionValidator 5.CustomValidator 6.ValidationSummary
7
ASP.Net Validation Controls
8
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
9
- Properties PropertyDescription ControlToValidateGives the id of the textbox to be validated. ErrorMessageIt provides text for the error message. SetFocusOnError Message Places the cursor in the associated text box. ValidationGroupIdentifies a grouping of TextBox controls to which a set of validation tests applies
10
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.
12
Control Tests the value within the range of the value. Values data types 1.Currency (with a dollar sign and commas) 2.Date 3.Double (floating-point) 4.Integer 5.String (default).
13
RangeValidator – General Format
14
RangeValidator - Properties 1.ControlToValidate 2.ErrorMessage 3.SetFocusOnErrorMessage 4.ValidationGroup Note: Same as RequiredFieldValidator Control 1.Type – It specifies the data type. 2.MinimumValue – Sets the minimum value 3.MaximumValue – Sets the Maximum value
15
RangeValidator
16
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.Date 3.Double (floating-point) 4.Integer 5.String (default).
18
PropertyDescription OperatorSets the comparison operator. Value To Compare It is used to set the target value to be tested.
20
Control This control is used to perform the additional test (Which cannot performed when used in combinations). General Format
21
- Properties Basic properties are similar to the RequiredFieldValidator Control. PropertyDescription IsValidSet to false to indicate the failure of the Validation Test OnServerVali date It calls a subprogram to perform explicitly coded tests. The called subprogram takes the special ServerValidateEventArgs argument.
22
- Properties
23
Regular Expression Validator Used to validate complex expressions. The expressions can be phone number email address zip code and many more. Set the ValidationExpression property to any type of expression OR Create the custom expression to validate the data.
24
Regular Expression Validator
26
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.
27
General Format Example
28
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.
30
Resource
31
Resources ASP.Net Validation Controls http://quickstarts.asp.net/QuickStartv20/aspnet/ doc/ctrlref/validation/validationsummary.aspx http://quickstarts.asp.net/QuickStartv20/aspnet/ doc/ctrlref/validation/validationsummary.aspx http://devhood.com/Tutorials/tutorial_details.asp x?tutorial_id=46 http://devhood.com/Tutorials/tutorial_details.asp x?tutorial_id=46 http://msdn.microsoft.com/en- us/library/aa479045.aspx http://msdn.microsoft.com/en- us/library/aa479045.aspx
32
Thank You
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.