[ZT] Asp.net form verification controls use collection

Source: Internet
Author: User
Asp.net form verification controls use collection

Verify the price (only integers or decimals are allowed ):
<Asp: regularexpressionvalidator id = "rev_price" runat = "server" controltovalidate = "price" validationexpression = "^ (\ D) + (\. \ D + )? $ "Errormessage =" the price can only be a number "> </ASP: regularexpressionvalidator>

Verify email format: faron@163.com
<Asp: regularexpressionvalidator id = "rev_email" runat = "server" controltovalidate = "email" validationexpression = "\ W + ([-+.] \ W +) * @ \ W + ([-.] \ W + )*\. \ W + ([-.] \ W +) * "errormessage =" Incorrect email format "> </ASP: regularexpressionvalidator>

Format of the verified phone number: 0571-88888888,13088888888
<Asp: regularexpressionvalidator id = "rev_tel" runat = "server" controltovalidate = "tel" validationexpression = "(^ [0-9] {3, 4} \-[0-9] {3, 8} $) | (^ [0-9] {3, 8} $) | (^ \ ([0-9] {3, 4} \) [0-9] {3, 8} $) | (^ 0 {0, 1} 13 [0-9] {9} $) "errormessage =" Incorrect Phone Number Format "> </ASP: regularexpressionvalidator>

The maximum length of input characters is 1-50 characters.
<Asp: regularexpressionvalidator id = "rev_title" runat = "server" display = "dynamic" controltovalidate = "title" validationexpression = "(\ w | \ W) {} "errormessage =" the length should be less than 50 characters "> </ASP: regularexpressionvalidator>

The range of input integers is limited, for example, the number range is 1-99.
<Asp: rangevalidator id = "rv_day" runat = "server" controltovalidate = "day" minimumvalue = "1" maximumvalue = "99" type = "integer" errormessage = "the number should be 1-99 "> </ASP: rangevalidator>

Verification URL format: www.163.com 163.com
<Asp: regularexpressionvalidator id = "rev_homepage" runat = "server" display = "dynamic" controltovalidate = "Homepage" validationexpression = "([\ W-] + \.) + [\ W-] + (/[\ W -. /? % & =] *)? "Errormessage =" Incorrect homepage format "> </ASP: regularexpressionvalidator>

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.