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>