Monday, 7 October 2013

How to do Asp.Net textbox validation in javascript


In this Section we learn how to do client side validation through javascript
 First we add Textbox  in our Validation.aspx page like this



OnClientClick="return validate();" is used to call the JavaScript function on click of the Submit button

Now in the validate() function, we will get the value of textboxes and check textboxes are blank or not like below:


Now for email value we will create a parameter that finds if the email format is valid or not as well as Given Password is same or not.

When user enters wrong information or may the user leaves a textbox blank, then the client side validation will be work. This will reduce server traffic and page reload problem

No comments:

Post a Comment