Require text entry - only if radio button checked

D

David Thielen

Hi;

I have a case where I need to require a TextBox be filled in only if a
certain radio button is checked. I can't use RequiredFieldValidator because
if the button is not checked, then it can be empty. But a
CustomValidator.OnServerValidate is not called if a TextBox is empty.

How should I handle this?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

see the "too much free time video" - http://www.windwardreports.com/film.htm
 
S

Steven Cheng[MSFT]

Thanks for Alessandro's input.

Hi Dave,

Does the "ValidateEmptyText" property the one you need? Please feel free
to post here if you have any further questions.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
 
T

Tasos Vogiatzoglou

You could also enable/disable the RequieredValidator by using a short
clientSide snippet. Something like radioButton.Attributes["onchange"] =
string.Format("ValidatorEnable(document.getElementById('{0}'),_
document.getElementById('{1}').checked);",requiredValidator.ClientID,radioButton.ClientID);

Regards,
Tasos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top