I have a drop down (dropdown2) that is required IF there is something in it but it\'s options data is driven by ajax from another dropdown (dropdown1) selec
So I didn't get JonH answer to work, and the rest is only client side. So this is my solution:
To disable a RequiredFieldValidator on the client side:
ValidatorEnable(document.getElementById("rfv"), false);
To disable a RequiredFieldValidator on the server side you can override the Validate() method like this:
public override void Validate()
{
bool disableRfv = input_to_check <> 1;
rfv.Enabled = disableRfv;
base.Validate();
}
Or, in VBasic:
Public Overrides Sub Validate()
Dim disable_rfv As Boolean = input_to_check <> 1
rfv.Enabled = disable_rfv
MyBase.Validate()
End Sub