I am using javascript to control RequiredFieldValidator as shown below
<script type="text/javascript" language="jscript">
window.onload = function () {
disablefield();
}
function disablefield()
{
if (document.getElementById('<%= RadioButton1.ClientID %>').checked == true)
{
document.getElementById('<%= TextBox1.ClientID %>').disabled = false
ValidatorEnable(document.getElementById('<%= RequiredFieldValidator1.ClientID %>'), true);
}
else if (document.getElementById('<%= RadioButton2.ClientID %>').checked == true) {
document.getElementById('<%= TextBox1.ClientID %>').disabled = true;
ValidatorEnable(document.getElementById('<%= RequiredFieldValidator1.ClientID %>'), false);
}
}
</script>
This code is working fine as of now.
The aspx code for the above is
Below is the validation summary
Go to the complete details ...