I do not understand your comment about jQuery in previous solution comments.
If you want to receive an array (List<SomeClass>) in your control, you need to generate HTML similar to this:
<input name="MyArray[0].Role" value="MyKey" type="hidden" />
<input id="MyKey" name = "MyArray[0].Selected" type="checkbox" checked = "checked" value="true" />
<input name="MyArray[0].Selected" value="false" type="hidden" />
Indexes must start at 0 (at least with MVC 2) and must be consecutive. Your
SomeClass
will typically then have a property
MyKey
that would identify the checkbox and another property
Selected
which will give the state.
In my case, since I was only interested in checked items, it seems that I do not set the key for unselected items.
I do not have source code I uses here at home... The HTML fragment was found by "View source code" in Internet Explorer.
I think there might be an easier way to do it by having a list in the model and properly render a partial view with nested names.... but I haven't tried it yet.