Validating controls in asp net
In the above example we have tied two validation controls to the Hire Date Text Box.The Range Validator does not validate the contents of an input control if the control is empty.You need to check the Is Valid property to know if a validation check failed.Validation is complete by the time you reach a click event.Simply put, never trust the data in an incoming request, and always validate on the server.
In the Properties dialog box find the Control To Validate property and select First Name Text Box from the drop down list. We can set other properties, such as the Error Message property, and the final ASPX source code should look like the following. NET work in a similar fashion to what we've seen above. If the client's web browser is of executing client side Java Script, the first validation pass occurs on the client.There are four key properties to initialize for a Range Validator.The Control To Validate property references the ID of the input control to check.This is the exact position the error message will appear if validation fails. This also improves response time on the server because the ASP.
For this first example we do not need to place much code into the code-behind file. NET runtime does not waste time processing a request with invalid information.The Minimum Value and Maximum Value properties control the allowed range of the input. This property can take one of the following values: String, Integer, Double, Date, or Currency.