Understanding Validation Controls in Web Development

7 validation controls n.w
1 / 17
Embed
Share

Learn how validation controls are used to ensure data accuracy in web applications, covering common properties, techniques, and advanced controls. Explore examples like RequiredFieldValidator, CompareValidator, and RangeValidator to enhance user input validation.

  • Web Development
  • Validation Controls
  • Data Validation
  • Error Handling

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. 7. Validation Controls [231-247] Name : Ankita Parulekar Presentation ID: 13 CSCI 5633

  2. outline Introduction How to use validation control Common validation properties Validation techniques Advanced validation controls

  3. Validation control A Validation control is used to validate the data of an input control. For example, error message will be displayed directly to the right of the text box, if it is not valid. We can use the validation controls with any of web server or HTML server input control. Validator is associated with single input control, but we can use two or more validators with same input control.

  4. Validation controls

  5. Required field validator <asp:RequiredFieldValidator runat="server" id="reqName" controltovalidate="txtName" errormessage="Please enter your name!" />

  6. Compare Validator <asp:CompareValidator runat="server" id="cmpPassword" controltovalidate= txtPassword" controltocompare= txtRePassword" type= Password" errormessage= Confirm password does not match the password" />

  7. Range Validator <asp:RangeValidator runat="server" id="rngDate" controltovalidate="txtDate" type="Date" minimumvalue="01-01-2006" maximumvalue="31-12-2006" errormessage="Please enter a valid date within 2006!" />

  8. Common Validator Properties

  9. Validation Techniques Validation summary control: Summarize all the errors on a page. Validation groups: Specifies which group should be validated when a page is posted.

  10. Validation Summary Control

  11. Validation Summary Control <asp:ValidationSummary DisplayMode="ValidationSummaryDisplayMode" />

  12. Validation Groups

  13. Validation Groups <asp:TextBox ID="TextBox1" Runat="server ValidationGroup="First"></asp:TextBox>

  14. Advanced Validation Control We can create our own validation routines. We can use Regular Expression validator to make sure that the input data matches to a particular pattern.

  15. Advanced validation control <asp:RegularExpressionValidator ID="regexpName" runat="server" ErrorMessage="This expression does not validate." ControlToValidate="txtName" ValidationExpression="^[a-zA-Z'.\s]{1,40}$" />

  16. Advanced Validation Control

  17. Advanced Validation Control

Related


More Related Content