For example, I have these 3 properties in my view model
public class PageViewModel
{
[Required]
public bool? HasControl { get; set; }
[Required]
public bool? Critical { get; set; }
[Required]
public string Description { get; set; }
}
The problem here is that I want to make the properties
Critical
Description
required if HasControl is true or not required if it's false, which is a radio button control.
I have tried disabling the controls on client-side but they still fail when checking Modelstate.IsValid.
Is there a way to handle this situation?