I Use Asp.Net MVC 2 with entity framework 4.
Here is the situation : I Have a checkbox and a textbox(Date Picker).
If the checkbox is checked, the textbox is required. If the checkbox is false, the textbox is not required.
Checkbox True => Textbox Required
Checkbox False => Textbox not required
<%:Html.CheckBoxFor(model => model.oEnvironment.Remediate) %>
<%= Html.TextBoxFor(model => model.oEnvironment.DatePick)%>
I know how to create a ValidationAttribute but I dont know how to create a validation class that verify if the checkbox is checked (if my Entity Remediate Attribute is true) and then put the DatePick field as required.
Any Idea ?