Vb net validating input

If a client with Internet Explorer 4.0 or later uses your page, it can do the same input validation that takes place on the server without you having to write any special client script.

The client side validation has a number of features: In order to use validators effectively, it helps to have a firm definition of what they are.

It is possible to provide the user with immediate feedback on bad input and to prevent them from posting a page until it has been corrected.If the input field is blank, we want to display an asterisk (*) in front of the field and report a text error in a summary area.Here is how we add a Required Field Validator to the User ID field: The * is displayed next to the label if the input is blank. The "Control To Validate" property specifies the ID of the control to validate.Each time you get a request, you need to write code to check the input and write any errors the user has made back to the page to help the user to correctly fill in the form.This is a taxing process for end users, developers, and servers alike.However, it can be almost impossible to guarantee that every user of your site has the required scripting environment.This usually means that if you want to use script to improve the interface of your pages, you have to write the same validation logic twice, once on the client, and again on the server, just in case the client script cannot be executed.You need to write the server-based checks anyway for clients without script, so it can be hard to justify writing it all over again for rich clients.Validation controls change all that, because almost all the duplicated logic is encapsulated in the controls.The final step is to add a validation summary to the top of the page like so: Here is how it looks on the page: Next we need to enforce the character requirements for the User ID and Password fields.For these we will use Regular Expression Validator controls.

You must have an account to comment. Please register or login here!