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.