RegularExpressionValidator for ASP. NET verification controls

Source: Internet
Author: User

The RegularExpressionValidator control is used to verify whether the input value matches the pattern specified by the regular expression. For example, email, phone number, zip code, integer, and decimal number. Regular Expressions can be used to combine various modes. Almost everything you want can be written. Let's take a look at this magic control. RegularExpressionValidator attributes: these attributes describe the display behavior of the idDisplay verification control of the BackColor background color ControlToValidate verified control. Valid values: · None-the verification message is never displayed inline. · Static-allocate space in the page layout for displaying verification messages. · Dynamic-If verification fails, the space used to display verification messages is dynamically added to the page. The Boolean value of EnableClientScript, specifying whether to enable client verification. Specifies whether to enable the validation control. ErrorMessage the text displayed in the ValidationSummary control when verification fails. Note: If the Text property is not set, the Text is displayed in the verification control. ForeColor: the foreground color of the control. The unique id of the id control. A boolean value of IsValid, indicating whether the associated input control has passed verification. Runat specifies that the control is a server control. Must be set to "server ". Text message displayed when verification fails. ValidationExpression specifies to verify the regular expression of the input control. On the client and server, the expression syntax is different. Let's look at an example: [html] <% @ Page Language = "C #" AutoEventWireup = "true" CodeBehind = "Enter your email address and phone number. aspx. cs "Inherits =" WebApplication1. enter your email address and phone number "%> <! DOCTYPE html> Note: unless the browser does not support client verification or EnableClientScript is set to false, server-side and client-side verification will be performed simultaneously. Note: If the input control is empty, verification fails. Use the RequiredFieldValidator control to make the field a required field.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.