DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

How To Enable Or Disable Asp.net Validation Control Using Javascript

12.15.2011
| 7605 views |
  • submit to reddit
        Here is the solution to enable/disable asp.net validation using javascript
 
Suppose i have dropdown which contain list of Asian countries and Other when user are selecting Other than only txtOtherCity is enbled else disable at that i disable required field validation for Other city (rfvOtherCity) 

//Syntax:
ValidatorEnable(ValidatorContronName,Boolean);
//Explanation:
ValidatorContronName:This is ClientID of the Validation control.
Boolean:true(Enable) or false(Disable)
//Example:
ValidatorEnable(document.getElementById('<%=rfvOtherCity.ClientID%>'), false);

<a href="http://www.java-forums.org/blogs/spring-framework/"><strong>Spring Framework</strong></a>