问题
I am having two Kendo checkboxes and I want to validate it as checking atleast one of them is required.
<h4>Choose your favorite dance form</h4>
<div class="form-group">
<div class="col-md-6">
@(Html.Kendo().CheckBoxFor(e => e.Salsa)
.Name("Salsa")
.Label("Salsa"))
<br />
@(Html.Kendo().CheckBoxFor(e => e.Latin)
.Name("Latin")
.Label("Latin"))
</div>
</div>
Below is how my properties are defined in my Model:
public bool Salsa { get; set; }
public bool Latin { get; set; }
How can I data annotate them, so that atleast one is required validation takes place.
Thanks!
来源:https://stackoverflow.com/questions/36925206/data-annotate-multiple-checkboxfor-columns-as-required-in-mvc