Disable validation controls based on a condition
I have an asp.net application that uses validation controls on textboxes. However,开发者_开发技巧 if the user enters a value in txtFieldA, then I want to disable the validation controls on txtFieldB and txtFieldC.
Simply use this JavaScript function
function Disable()
{
var myVal = document.getElementById('myValidatorClientID');
ValidatorEnable(myVal, false);
}
Override Page.Validate()
or Page.Validate(string)
to change the default validation policy.
精彩评论