Introduction
Here is the solution to enable/disable ASP.NET validation using JavaScript.
Scenario: Suppose I have a dropdown which contains a list of Asian countries and Other when user is selecting Other
than only txtOtherCity
is enabled else disable, at that I disable the required field validation for Other
city (rfvOtherCity
).
ValidatorEnable(ValidatorContronName,Boolean);
ValidatorContronName:This is ClientID of the Validation control.
Boolean:true(Enable) or false(Disable)
ValidatorEnable(document.getElementById('<%=rfvOtherCity.ClientID%>'), false);
Please provide a "Vote" if this would be helpful .
Thanks,
Imdadhusen