I have list of checkboxes on my view using html helper as below. They are not required field.:-
@Html.CheckBoxFor(m=> m.List1[0].myClass.myValue)
@Html.CheckBoxFor(m=> m.List1[1].myClass.myValue)
@Html.CheckBoxFor(m=> m.List1[2].myClass.myValue)
@Html.CheckBoxFor(m=> m.List1[3].myClass.myValue)
with myValue property defined as below in class :-
[XmlIgnore]
public bool myValue{ get; set; }
On form submission the I am getting "A value if required" error for each checkbox. On checking the html page in browser tool. I founf dollowing which seems to be issue: -
<input name="List1[0].myClass.myValue" type="hidden" value>
I am not sure why this value doesn't even set to false when checkboxes are left un-checked.How can i avoid this validation error of "A value is required".