Skip to content Skip to sidebar Skip to footer

Enable/disable Asp Validation Control In Javascript

I want my validation control to be enable/disable with javascript. When I click on radiobutton list(yes/no), 2-3 rows becomes visible. Once Yes is clicked, then and only then user

Solution 1:

Add code below right after ValidatorEnable(control, enable) method call:

if (control.style.visibility == "visible") {
     control.style.visibility = "hidden";
} else {
     control.style.display = "none";
}

Solution 2:

functionHasPageValidators() {
    var hasValidators = false;

    try {
        if (Page_Validators.length > 0) {
            hasValidators = true;
        }
    }
    catch (error) {
    }

    return hasValidators;
}

functionValidationGroupEnable(validationGroupName, isEnable) {
    if (HasPageValidators()) {
        for (i = 0; i < Page_Validators.length; i++) {
            if (Page_Validators[i].validationGroup == validationGroupName) {
                ValidatorEnable(Page_Validators[i], isEnable);
            }
        }
    }
}

Then call:

ValidationGroupEnable('validationgroup', false);

i think it will help you....

Post a Comment for "Enable/disable Asp Validation Control In Javascript"