I have a radio button with values, “Yes” and “No”. If user selects “Yes”, the text box slides down. So it has to be validated. If user clicks “No”, the textbox slides up and there is no need for validation.
I tried to use, ValidationMessageFor(model => model.TextBoxValue), but I am not able to submit the form as, it validates the text box even it is slided up.
The “JQuery.Validate” library might be a reasonable solution. It will allow you to validate your field based on some condition. Syntax is fairly expressive: