I would like to post a form with a variable number of check-boxes, so in Model-biding i would receive an array or IEnumerable
with each checkbox
name and it's value.
What I pretend:
public class ItemsChecked{
public IEnumerable<string> Names{get; set;}
public IEnumerable<bool> Checked{get; set;}
//maybe organized in some other way
}
//In view
@model IEnumerable<Tuple<string,bool>>
@foreach(var role in Model)
{
<input name="@role.Item1" type="checkbox" checked="@role.Item2"/>
}
Is there any way to bind this to the ItemsChecked?