SlideShare uma empresa Scribd logo
1 de 14
• Understanding Validation
• Validation Controls
• BaseValidator Class Properties
• Validator Specific Properties
• Validating with Regular Expressions
• Regular Expression Characters
• Commonly used Regular Expressions
• Validation Summary Control
• Manual Validation
• Validation Groups
Validation means ensuring that the data inserted into an
application satisfies defined formats and other input criteria.


Some possible mistakes a user can make:
• Users might ignore an important field and leave it blank.
• Users might try to type a short string of nonsense to
  circumvent a required field check.
• Enter a nonnumeric character in a number field.
• Malicious users might try to exploit a weakness in your
  code by entering carefully structured wrong values
ASP.NET provides five validator controls. Four are
targeted at specific types of validation, while the fifth
allows you to apply custom validation routines
All the validation controls are found in the System.Web.UI.WebControls
namespace and inherit from the BaseValidator class.

Property             Description
ControlToValidate    Identifies the control that is to be validated
Error Message        If validation fails, the validator control can display a text
                     message set by this property
ForeColor            By changing the ForeColor, you can make the error
                     message stand out
Display              Dynamic, Static or None
IsValid              Returns true or false depending on whether it
                     succeeded or failed
Enabled              When set to false, automatic validation will not be
                     performed for this control when the page is submitted
EnableClientScript   If set to true, ASP.NET will add JavaScript and DHTML
                     code to allow client-side validation on browsers that
                     support it.
One of ASP.NET’s most powerful validation controls is the
RegularExpressionValidator, which validates text by determining
whether it matches a specific pattern.

333sddd
s represents any whitespace character (such as a space or tab). d
represents any digit

You can use the plus (+) sign to represent a repeated character. For
example, 5+7 means “one or more occurrences of the character 5,
followed by a single 7.” The number 57 would match, as would
555557

The following expression would match any word that starts with a
letter from a to f, contains one or more “word” characters (letters),
and ends with ing—possible matches include acting and developing.
[a-f]w+ing
In some modern browsers, ASP.NET automatically
adds JavaScript code for client-side validation. In this
case, when the user clicks a CausesValidation button,
the same error messages will appear without the page
needing to be submitted and returned from the server.
This increases the responsiveness of your web page.

However, even if the page validates successfully on
the client side, ASP.NET still revalidates it when it’s
received at the server.
What happens when the user clicks a button :

• If CausesValidation is false, ASP.NET will ignore the
validation controls, the page will be posted back, and
your event handling code will run normally.

• If CausesValidation is true (the default), ASP.NET will
automatically validate the page when the user clicks
the button. It does this by performing the validation for
each control on the page. If any control fails to
validate, ASP.NET will return the page with some error
information. Your click event handling code may or
may not be executed.
Use IsValid property in a conditional logic and write
event handling code inside it.
Accommodates all the error messages from all the
validation controls at a suitable location normally at the
bottom of the page.

Error messages from all the validators are hided by
setting their Display property to None.

When you run the page, you won’t see any dynamic
messages as you enter invalid information and
tab to a new field. However, when you click the OK
button, the ValidationSummary will appear with a list
of all error messages.

It automatically retrieves the value of the ErrorMessage
property from each validator
In some cases, you’ll want to display a full message in
the summary and some sort of visual indicator next to
the offending control

You can use this technique with the help of the Text
property of the validators. Ordinarily, Text is left empty,
and the validator doesn’t show any content in the web
page. However, if you set both Text and ErrorMessage,
the ErrorMessage value will be used for the summary
while the Text value is displayed in the validator.

Of course, you’ll need to make sure you aren’t also
setting the Display property of your validator to None.
Manual validation is when you disable validation and perform
the work on your own. This allows you to create a specialized
error message of your own.
You can create manual validation in one of three ways:

I.    Use your own code to verify values. In this case, you
      won’t use any of the ASP.NET validation controls.

II.   Disable the EnableClientScript property for each
      validation control. This allows an invalid page to be
      submitted, after which you can decide what to do with
      itdepending on the problems that may exist.

III. Add a button with CausesValidation set to false. When
     this button is clicked, manually validate the page by
     calling the Page.Validate() method. Then examine the
     IsValid property, and decide what to do.
Every control that provides a CausesValidation property
also includes the ValidationGroup property.

In some situations you might have several distinct groups of
controls, possibly in separate panels and you may want to
perform validations separately.

To create a validation group, you need to set the
ValidationGroup property of every control in the same
logical group with the same descriptive string.

Mais conteúdo relacionado

Mais procurados

ASP.NET Validation Control
ASP.NET Validation ControlASP.NET Validation Control
ASP.NET Validation ControlZAIYAUL HAQUE
 
Data validation in web applications
Data validation in web applicationsData validation in web applications
Data validation in web applicationssrkirkland
 
Create rest webservice for oracle public api using java class via jdeveloper
Create rest webservice for oracle public api using java class via jdeveloperCreate rest webservice for oracle public api using java class via jdeveloper
Create rest webservice for oracle public api using java class via jdevelopershravan kumar chelika
 
Less04 2 e_testermodule_3
Less04 2 e_testermodule_3Less04 2 e_testermodule_3
Less04 2 e_testermodule_3Suresh Mishra
 
Request Validation In Spring Rest-Part2
Request Validation In Spring Rest-Part2Request Validation In Spring Rest-Part2
Request Validation In Spring Rest-Part2Mohammad Sabir Khan
 
How to build quality software
How to build quality softwareHow to build quality software
How to build quality softwareMake School
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniummindqqa
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9Sisir Ghosh
 
Automating with selenium2
Automating with selenium2Automating with selenium2
Automating with selenium2mindqqa
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingSarah Elson
 
Practical Dynamic Actions - Intro
Practical Dynamic Actions - IntroPractical Dynamic Actions - Intro
Practical Dynamic Actions - IntroJorge Rimblas
 
Selenium ide1
Selenium ide1Selenium ide1
Selenium ide1mindqqa
 
Transforming Power Point Show with VBA
Transforming Power Point Show with VBATransforming Power Point Show with VBA
Transforming Power Point Show with VBADCPS
 
Visual Studio and Xamarin: The future of app development
Visual Studio and Xamarin: The future of app developmentVisual Studio and Xamarin: The future of app development
Visual Studio and Xamarin: The future of app developmentMicrosoft Tech Community
 
Selenium
SeleniumSelenium
Seleniumnil65
 
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
 AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless WaySrushith Repakula
 

Mais procurados (20)

ASP.NET Validation Control
ASP.NET Validation ControlASP.NET Validation Control
ASP.NET Validation Control
 
Data validation in web applications
Data validation in web applicationsData validation in web applications
Data validation in web applications
 
Create rest webservice for oracle public api using java class via jdeveloper
Create rest webservice for oracle public api using java class via jdeveloperCreate rest webservice for oracle public api using java class via jdeveloper
Create rest webservice for oracle public api using java class via jdeveloper
 
Less04 2 e_testermodule_3
Less04 2 e_testermodule_3Less04 2 e_testermodule_3
Less04 2 e_testermodule_3
 
Build Restful Service using ADFBC
Build Restful Service using ADFBCBuild Restful Service using ADFBC
Build Restful Service using ADFBC
 
Request Validation In Spring Rest-Part2
Request Validation In Spring Rest-Part2Request Validation In Spring Rest-Part2
Request Validation In Spring Rest-Part2
 
How to build quality software
How to build quality softwareHow to build quality software
How to build quality software
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Spring REST Request Validation
Spring REST Request ValidationSpring REST Request Validation
Spring REST Request Validation
 
ASP.NET Session 9
ASP.NET Session 9ASP.NET Session 9
ASP.NET Session 9
 
Automating with selenium2
Automating with selenium2Automating with selenium2
Automating with selenium2
 
Using galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testingUsing galen framework for automated cross browser layout testing
Using galen framework for automated cross browser layout testing
 
Practical Dynamic Actions - Intro
Practical Dynamic Actions - IntroPractical Dynamic Actions - Intro
Practical Dynamic Actions - Intro
 
Selenium ide1
Selenium ide1Selenium ide1
Selenium ide1
 
Transforming Power Point Show with VBA
Transforming Power Point Show with VBATransforming Power Point Show with VBA
Transforming Power Point Show with VBA
 
Visual Studio and Xamarin: The future of app development
Visual Studio and Xamarin: The future of app developmentVisual Studio and Xamarin: The future of app development
Visual Studio and Xamarin: The future of app development
 
Selenium
SeleniumSelenium
Selenium
 
Java Custom Annotations- Part1
Java Custom Annotations- Part1Java Custom Annotations- Part1
Java Custom Annotations- Part1
 
Exception handling
Exception handlingException handling
Exception handling
 
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
 AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
AWS Lambda Hands-on: How to Create Phone Call Notifications in a Serverless Way
 

Semelhante a Chapter 9

Mastering Assertions in Automation Testing, Importance and Best Practices.pdf
Mastering Assertions in Automation Testing, Importance and Best Practices.pdfMastering Assertions in Automation Testing, Importance and Best Practices.pdf
Mastering Assertions in Automation Testing, Importance and Best Practices.pdfpcloudy2
 
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptxvnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptxYamunaS38
 
Data validation in silverlight
Data validation in silverlightData validation in silverlight
Data validation in silverlightmsarangam
 
ASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsRandy Connolly
 
Selenium ide material (2)
Selenium ide material (2)Selenium ide material (2)
Selenium ide material (2)Sriram Angajala
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10Sisir Ghosh
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsQUONTRASOLUTIONS
 
Selenium ide material (1)
Selenium ide material (1)Selenium ide material (1)
Selenium ide material (1)Sriram Angajala
 
What are Anypoint Validations With Mulesoft
What are Anypoint Validations With Mulesoft What are Anypoint Validations With Mulesoft
What are Anypoint Validations With Mulesoft Jitendra Bafna
 
validation-controls.pdf ioue8n uoh souu o3i
validation-controls.pdf ioue8n uoh souu  o3ivalidation-controls.pdf ioue8n uoh souu  o3i
validation-controls.pdf ioue8n uoh souu o3iCoRRexGaMing
 
Chapter 3 (validation control)
Chapter 3 (validation control)Chapter 3 (validation control)
Chapter 3 (validation control)let's go to study
 
Ch3- Java Script.pdf
Ch3- Java Script.pdfCh3- Java Script.pdf
Ch3- Java Script.pdfHASENSEID
 

Semelhante a Chapter 9 (20)

2310 b 07
2310 b 072310 b 07
2310 b 07
 
Mastering Assertions in Automation Testing, Importance and Best Practices.pdf
Mastering Assertions in Automation Testing, Importance and Best Practices.pdfMastering Assertions in Automation Testing, Importance and Best Practices.pdf
Mastering Assertions in Automation Testing, Importance and Best Practices.pdf
 
OLT open script
OLT open script OLT open script
OLT open script
 
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptxvnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
vnd.openxmlformats-officedocument.presentationml.presentation&rendition=1.pptx
 
Data validation in silverlight
Data validation in silverlightData validation in silverlight
Data validation in silverlight
 
Wheels
WheelsWheels
Wheels
 
ASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation ControlsASP.NET 05 - Exception Handling And Validation Controls
ASP.NET 05 - Exception Handling And Validation Controls
 
Selenium ide material (2)
Selenium ide material (2)Selenium ide material (2)
Selenium ide material (2)
 
ASP.NET Session 10
ASP.NET Session 10ASP.NET Session 10
ASP.NET Session 10
 
Asp.net validation
Asp.net validationAsp.net validation
Asp.net validation
 
Test automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra SolutionsTest automation using selenium presented by Quontra Solutions
Test automation using selenium presented by Quontra Solutions
 
Selenium ide material (1)
Selenium ide material (1)Selenium ide material (1)
Selenium ide material (1)
 
validation
validationvalidation
validation
 
What are Anypoint Validations With Mulesoft
What are Anypoint Validations With Mulesoft What are Anypoint Validations With Mulesoft
What are Anypoint Validations With Mulesoft
 
validation-controls.pdf ioue8n uoh souu o3i
validation-controls.pdf ioue8n uoh souu  o3ivalidation-controls.pdf ioue8n uoh souu  o3i
validation-controls.pdf ioue8n uoh souu o3i
 
Chapter 3 (validation control)
Chapter 3 (validation control)Chapter 3 (validation control)
Chapter 3 (validation control)
 
Validation controls in asp
Validation controls in aspValidation controls in asp
Validation controls in asp
 
Project1 CS
Project1 CSProject1 CS
Project1 CS
 
Ch3- Java Script.pdf
Ch3- Java Script.pdfCh3- Java Script.pdf
Ch3- Java Script.pdf
 
Project1 VB
Project1 VBProject1 VB
Project1 VB
 

Mais de application developer (20)

Chapter 26
Chapter 26Chapter 26
Chapter 26
 
Chapter 25
Chapter 25Chapter 25
Chapter 25
 
Chapter 23
Chapter 23Chapter 23
Chapter 23
 
Assignment
AssignmentAssignment
Assignment
 
Next step job board (Assignment)
Next step job board (Assignment)Next step job board (Assignment)
Next step job board (Assignment)
 
Chapter 19
Chapter 19Chapter 19
Chapter 19
 
Chapter 18
Chapter 18Chapter 18
Chapter 18
 
Chapter 17
Chapter 17Chapter 17
Chapter 17
 
Chapter 16
Chapter 16Chapter 16
Chapter 16
 
Week 3 assignment
Week 3 assignmentWeek 3 assignment
Week 3 assignment
 
Chapter 15
Chapter 15Chapter 15
Chapter 15
 
Chapter 14
Chapter 14Chapter 14
Chapter 14
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Chapter 12
Chapter 12Chapter 12
Chapter 12
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
C # test paper
C # test paperC # test paper
C # test paper
 
Chapter 8 part2
Chapter 8   part2Chapter 8   part2
Chapter 8 part2
 
Chapter 8 part1
Chapter 8   part1Chapter 8   part1
Chapter 8 part1
 
Chapter 7
Chapter 7Chapter 7
Chapter 7
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 

Chapter 9

  • 1. • Understanding Validation • Validation Controls • BaseValidator Class Properties • Validator Specific Properties • Validating with Regular Expressions • Regular Expression Characters • Commonly used Regular Expressions • Validation Summary Control • Manual Validation • Validation Groups
  • 2. Validation means ensuring that the data inserted into an application satisfies defined formats and other input criteria. Some possible mistakes a user can make: • Users might ignore an important field and leave it blank. • Users might try to type a short string of nonsense to circumvent a required field check. • Enter a nonnumeric character in a number field. • Malicious users might try to exploit a weakness in your code by entering carefully structured wrong values
  • 3. ASP.NET provides five validator controls. Four are targeted at specific types of validation, while the fifth allows you to apply custom validation routines
  • 4. All the validation controls are found in the System.Web.UI.WebControls namespace and inherit from the BaseValidator class. Property Description ControlToValidate Identifies the control that is to be validated Error Message If validation fails, the validator control can display a text message set by this property ForeColor By changing the ForeColor, you can make the error message stand out Display Dynamic, Static or None IsValid Returns true or false depending on whether it succeeded or failed Enabled When set to false, automatic validation will not be performed for this control when the page is submitted EnableClientScript If set to true, ASP.NET will add JavaScript and DHTML code to allow client-side validation on browsers that support it.
  • 5.
  • 6. One of ASP.NET’s most powerful validation controls is the RegularExpressionValidator, which validates text by determining whether it matches a specific pattern. 333sddd s represents any whitespace character (such as a space or tab). d represents any digit You can use the plus (+) sign to represent a repeated character. For example, 5+7 means “one or more occurrences of the character 5, followed by a single 7.” The number 57 would match, as would 555557 The following expression would match any word that starts with a letter from a to f, contains one or more “word” characters (letters), and ends with ing—possible matches include acting and developing. [a-f]w+ing
  • 7.
  • 8.
  • 9. In some modern browsers, ASP.NET automatically adds JavaScript code for client-side validation. In this case, when the user clicks a CausesValidation button, the same error messages will appear without the page needing to be submitted and returned from the server. This increases the responsiveness of your web page. However, even if the page validates successfully on the client side, ASP.NET still revalidates it when it’s received at the server.
  • 10. What happens when the user clicks a button : • If CausesValidation is false, ASP.NET will ignore the validation controls, the page will be posted back, and your event handling code will run normally. • If CausesValidation is true (the default), ASP.NET will automatically validate the page when the user clicks the button. It does this by performing the validation for each control on the page. If any control fails to validate, ASP.NET will return the page with some error information. Your click event handling code may or may not be executed. Use IsValid property in a conditional logic and write event handling code inside it.
  • 11. Accommodates all the error messages from all the validation controls at a suitable location normally at the bottom of the page. Error messages from all the validators are hided by setting their Display property to None. When you run the page, you won’t see any dynamic messages as you enter invalid information and tab to a new field. However, when you click the OK button, the ValidationSummary will appear with a list of all error messages. It automatically retrieves the value of the ErrorMessage property from each validator
  • 12. In some cases, you’ll want to display a full message in the summary and some sort of visual indicator next to the offending control You can use this technique with the help of the Text property of the validators. Ordinarily, Text is left empty, and the validator doesn’t show any content in the web page. However, if you set both Text and ErrorMessage, the ErrorMessage value will be used for the summary while the Text value is displayed in the validator. Of course, you’ll need to make sure you aren’t also setting the Display property of your validator to None.
  • 13. Manual validation is when you disable validation and perform the work on your own. This allows you to create a specialized error message of your own. You can create manual validation in one of three ways: I. Use your own code to verify values. In this case, you won’t use any of the ASP.NET validation controls. II. Disable the EnableClientScript property for each validation control. This allows an invalid page to be submitted, after which you can decide what to do with itdepending on the problems that may exist. III. Add a button with CausesValidation set to false. When this button is clicked, manually validate the page by calling the Page.Validate() method. Then examine the IsValid property, and decide what to do.
  • 14. Every control that provides a CausesValidation property also includes the ValidationGroup property. In some situations you might have several distinct groups of controls, possibly in separate panels and you may want to perform validations separately. To create a validation group, you need to set the ValidationGroup property of every control in the same logical group with the same descriptive string.