swathi111
asked on
RequiredFieldValidator for an optional field
Hi,
Please find the attached file.
If i select Add New radio button, RadEditor control will be displayed.If I select Link to existing radio button, URL field will be displayed. If user select Add New then RadEditor is a mandatory field. If user select Link to Existing then URL field is the mandatory field. How to check this?
I put 2 RequiredFieldValidator controls and by default i make it enabled = false then on click of submit button i enabled as below but it is not working:
protected void btnSubmit_Click(object sender, EventArgs arg)
{
if (radioAddNew.Checked)
RequiredFieldValidatorRadE ditorConte nt.Enabled = true;
else if (radioLinkToExisting.Check ed)
RequiredFieldValidatorURL. Enabled = true;
if (Page.IsValid)
{
//other code
}
}
Any other way to do this?
Thanks,
Requiredfieldvalidator.jpg
Please find the attached file.
If i select Add New radio button, RadEditor control will be displayed.If I select Link to existing radio button, URL field will be displayed. If user select Add New then RadEditor is a mandatory field. If user select Link to Existing then URL field is the mandatory field. How to check this?
I put 2 RequiredFieldValidator controls and by default i make it enabled = false then on click of submit button i enabled as below but it is not working:
protected void btnSubmit_Click(object sender, EventArgs arg)
{
if (radioAddNew.Checked)
RequiredFieldValidatorRadE
else if (radioLinkToExisting.Check
RequiredFieldValidatorURL.
if (Page.IsValid)
{
//other code
}
}
Any other way to do this?
Thanks,
Requiredfieldvalidator.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.