if you want the checkbox to update the model via the binder, then you need a boolean value to bind to and name them properly. If Functionality object had bool Selected property then its:
@for(int i=0; i < Model.Functionality.Count; ++i)
{
<tr><td>
@Html.CheckBoxFor(m=>m.Functionality[i].Selected)
@Html.HiddenFor(m=>m.Functionality[i].ID)
@Html.LabelFor(m=>m.Functionality[i].Selected,Model.Functionality[i].DisplayName)
</td></tr>
}
to validate it depends on how you are doing your validation. if you are using unobtrusive validation, then you create a validation attribute, apply to the Selected property. then client side you add a client rule, register it to the adapters. see docs, or google for examples.
|