ASP. NET-verify server controls

Source: Internet
Author: User

ASP. NET-verify server controls are used to verify user input. If the user input fails to pass the verification, an error message is displayed to the user.

ASP. NET-verify server controls
The verification server control is used to verify user input. If the user input fails to pass the verification, an error message is displayed to the user.

Each verification control performs a specific type of verification (for example, confirming a value for a specific value or range ).

By default, when a Web page is verified, a button, ImageButton, or LinkButton, is clicked. You can set the CausesValidation attribute to false by pressing a button during verification.

Syntax creates a verification Server Control item:

<Asp: control_name id = "some_id" runat = "server"/>

In the following example, we declare a TextBox Control, a Button control, and a RangeValidator control.

 

Aspx file. If verification fails, the value of the text "must be from 1 to 100! "Will be displayed in the RangeValidator control:

 

<Form runat = "server"> <p> Enter a number from 1 to 100: <asp: textBox id = "tbox1" runat = "server"/> <br/> <asp: button Text = "Submit" runat = "server"/> </p>

<P> <asp: RangeValidatorControlToValidate = "tbox1" MinimumValue = "1" MaximumValue = "100" Type = "Integer" Text = "The value must be from 1 to www.111cn.cn! "Runat =" server "/> </p>
</Form> For more information, see www.111cn.cn.

Related Article

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.