asp.net-Validating server controls
Verify that the server control is used to authenticate user input. If user input does not pass validation, it displays an error message to the consumer.
Each validation control performs a specific type of validation, such as confirming a value for a particular value or a range.
By default, when a Web page is validated, a button, ImageButton, or LinkButton control is clicked. You can prevent validation when a button, press control to set the CausesValidation property to False.
Syntax to create a validation server control is:
<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 validation fails, the value of text "must be from 1 to 100!" "will appear in the RangeValidator control:
<form runat=" Server "> <p>enter a number from 1 to: <asp : TextBox id= "Tbox1" runat= "server"/> <br/><br/> <asp:button text= "Submit" runat= "Server"/> </ P
<p> <asp:rangevalidator controltovalidate= "Tbox1" minimumvalue= "1" maximumvalue= "type=" Integer "text=" The value must is from 1 to www.111cn.net! runat= "Server"/> </p>
</form> Reprint Please specify www.111cn.net