Jan 12, 2012

Dynamically Enable or Disable ASP.NET Validator and Page.IsValid

In my post, I discussed different client side APIs and Methods of asp.net validator Controls. Now suppose if you have customized validation on client side, what’ll happen on server side? We need to do same on server side. Let’s understand this step by step by taking same example. Suppose you have to disable password’s requiredfieldvalidator when ‘Allow me‘ checkbox is true. You have disabled validator on checkbox click using ValidatorEnable javascript method. Now on server side button click, if you validate and check for isValid, it is always false and you will see error message in validationsummary even if checkbox is checked. Client side bypasses validation but on server side it’s stucked and our object is defeated.

Sep 10, 2011

Client Side Validation using ASP.NET Validator Controls from Javascript

ASP.NET validation controls provide functionality to perform validation using client script. By default, when client-side validation is being performed, the user cannot post the page to the server if there are errors on the page thus the user experience with the page is enhanced.