Thursday 22 November 2012

Validation and Javascript

Validation and Javascript

Most of the Asp.Net programmer use different validation control to validate user input. But basically so many developers do not know how it works. Validation controls are use to validate user input and it is basically work as JavaScript, so we can use this validation controls instead of writing JavaScript to validate user input. The main advantage of this validation control is that it can be use with the web browser which has disabled the JavaScript or browser does not support JavaScript, because even when validation cannot happen on client side, validation still perform on server side.

            If the user has disabled the JavaScript in their web browser the page will post-back to the server without performing client side validating and the code will execute related the button’s click event (i.e.: Entry to the DB it will create fake or Null). But you can stop this by validate this user input at server side. For that you have to check following property Page.IsValid. It will return true if the validation control does not have any error or it will return false if validation control contain error.

            It is easy to forget that to check Page.IsValid property because you always work with the web browser which has enabled JavaScript.


No comments:

Post a Comment

Thank You for Your Comments. We will get back to you soon.

back to top