Click here to Skip to main content
14,392,108 members
Rate this:
Please Sign up or sign in to vote.
See more:
Dear All,

We have a dropdown & requiredfield validator control,which display none and enabled false using javascript.But when we call Page.IsValid the controls return false.

JS Code
var value = ddl.options[ddl.selectedIndex].value;
var selDestCountry = document.getElementById("<%= ddlRemBenefRelationshipType.ClientID %>");
if (selDestCountry.value == '01') {
document.getElementById("<%=lblRemBenefRelationShip.ClientID%>").style.display = "block";
document.getElementById("<%=ddlRemBenefRelationshipPrivate.ClientID%>").style.display = "block";
document.getElementById("<%=rfvBenefRelationshipPrivate.ClientID%>").style.display = "block";
document.getElementById("<%=rfvBenefRelationshipPrivate.ClientID%>").enabled = true;

document.getElementById("<%=ddlRemBenefRelationshipBussiness.ClientID%>").style.display = "none";
document.getElementById("<%=txtOtherBenefRelationship.ClientID%>").style.display = "none";
document.getElementById("<%=rfvBenefRelationshipBussiness.ClientID%>").style.display = "none";

document.getElementById("<%=rfvBenefRelationshipOther.ClientID%>").style.display = "none";
document.getElementById("<%=rfvBenefRelationshipBussiness.ClientID%>").enabled = false;
document.getElementById("<%=rfvBenefRelationshipOther.ClientID%>").enabled = false;

When the control value returns 01 then view the mentioned controls & disable the remaining controls.

Please help.

What I have tried:

We tried VallidatorEnable JS Function also but its not working.We tried EnableClientScript also.But no result.
Vincent Maverick Durano 17-Aug-16 13:47pm
Do you really need to validate hidden input controls? What's the purpose?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100