1
下面我有三个不同的类别。带Bools的数据注释
我将如何构造验证以确保每个类别至少选择一个布尔值?
//残疾人
[Display(Name = "Learning Disabilities")]
public bool LD { get; set; }
[Display(Name = "Developmental Disabilities")]
public bool DD { get; set; }
[Display(Name = "AD/HD")]
public bool ADHD { get; set; }
[Display(Name = "Autism")]
public bool Autism { get; set; }
//年龄组
[Display(Name = "Child")]
public bool child { get; set; }
[Display(Name = "Youth")]
public bool youth { get; set; }
[Display(Name = "Adult")]
public bool adult { get; set; }
//策略类型
[Display(Name = "Academic")]
public bool academic { get; set; }
[Display(Name = "Behaviour")]
public bool behaviour { get; set; }
[Display(Name = "Communication")]
public bool communication { get; set; }
[Display(Name = "Social")]
public bool social { get; set; }
可能重复。如何设置验证,要求两个字段之一取决于模型的布尔值?](http://stackoverflow.com/questions/11143151/asp-net-mvc3-how-to-set-validation-to-require-之一的两字段-取决于-ON-BO) – MarcinJuraszek