. Net verification control

Source: Internet
Author: User
Control name Description
Requiredfieldvalidator Make sure that the user does not skip the input.
Comparevalidator Use comparison operators (less than, equal to, greater than, and so on) to compare user input with the constant value or attribute value of another control.
Rangevalidator Check whether user input is between the specified upper and lower boundary. Check the internal range of numbers, letters, or dates. The boundary can be expressed as a constant.
Regularexpressionvalidator Check whether the input matches the pattern defined by the regular expression. This verification type allows you to check for predictable character sequences, such as social security numbers, email addresses, phone numbers, and postal codes.
Customvalidator Use your own verification logic to check user input. This verification type allows you to check the value exported during runtime.
Validationsummary Displays verification errors for all validators on the page as a summary.
 
<
Script Language = "C #" runat = Server>
Void servervalidate (Object source, servervalidateeventargs value)
{
Int num = int32.parse (value. Value); If (Num % 2 = 0)
{Value. isvalid = true; return;
} Else
Value. isvalid = false;
} </SCRIPT> < Script Language = "JavaScript"> Function clientvalidate (source, arguments) {If (arguments. Value % 2 = 0) arguments. isvalid = true; else arguments. isvalid = false;} </SCRIPT>
<Form runat = "server"> <Asp: customvalidator id = "customvalidator1" runat = "server" controltovalidate = "text1" clientvalidationfunction = "clientvalidate" <! -- Client Server event name --> Onservervalidate = "servervalidate" <! -- Server event name --> Display = "static" font-name = "verdana" font-size = "10pt"> Not an even number! </ ASP: customvalidator> <P> < ASP: button text = "verify" onclick = "validatebtn_onclick" runat = "server"/> </Form>

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.