Client-side validation
If you use input forms on your site, you probably use input validation required fields, correct e-mail format, and so on. If you currently do all your validation on the server, you can greatly decrease traffic between browser and server by adding client-side validation.
This means that a bit of JavaScript on the page validates the form before it is sent to the server, and shows an error message if something is wrong. This way, the visitor doesn't have to wait for a postback before finding out that they made a mistake, and you get to save bandwidth. Client-side validation doesn't replace server-side validation a malicious user can easily circumvent it and send invalid data.
Introducing client-side validation is pretty easy, and doesn't require a lot of JavaScript coding. We'll have a look at two popular ways to implement client-side validation: ASP.NET validation controls, and the Validate JavaScript library.
ASP.NET validation controls
ASP.NET comes with five validation...