I am trying to make sure that at least one 'input checkbox is checked in this list there is about 10 items but I am not sure how to do this? Do I need a flag in the model?
<div>* Data</div>
@Html.ValidationMessageFor(x => x.flgData,"", new { @class = "text-danger" })
<ul>
@foreach (var item in Model.ListOfData)
{
<li>
<input type="checkbox" value="@item.Value" name="chk" />
<label asp-for="@item.Selected">@Html.Raw(@item.Name)</label>
<input type="hidden" asp-for="@item.DictionaryId" />
<input type="hidden" asp-for="@item.Name" />
</li>
}
</ul>