Is it possible to create a data annotation that allows me to say if QuestionType = "dropdown" then SelectedValue is Required?
Here is my Model:
public class QuestionViewModel
{
public int? Id { get; set; }
public string QuestionType { get; set; }
public string SubType { get; set; }
public string Text { get; set; }
public int SortOrder { get; set; }
public bool IsHidden { get; set; }
public int SelectedValue { get; set; }
public List<QuestionOptionViewModel> Options { get; set; }
}
What I want to say is if the QuestionType is of a specific type (dropdown) then SelectedValue is Required.