I have all fields set to required using the requiredfield control in asp.net but i need one field to change its requiredfield control to disabled depending on a radio button answer. Is there a way to do this without using javascript?
Asked
Active
Viewed 84 times
1 Answers
0
On the radiobutton selection (OnChecked_Changed) event do the setting
if(radiobutton.Checked)
{
requiredFieldValidatorID.Enabled = false;
}
else
{
requirefFieldValidatorID.Enabled = true;
}
Be sure you use validationGroup, Then on the Submit of the page call that.
Page.Validate("validationGroupName");
Then check is page valid to continue e.g.
//call page validation
Page.Validate("validationGroupName");
if(Page.IsValid)
{
// process here
}

JobesK
- 347
- 1
- 2
- 6