Ok, I have a role based permission system in place and would like admin's to be able to edit the permissions for each role. To do this I need to load lots of checkboxes, however I'm struggling with getting the return data from the View
Please Note: I have looked around, I have found similar questions but as of yet cannot find a solution.
<%
Html.BeginForm();
string lastGroup = "";
foreach (var CurPermission in Model)
{
%>
<%=Html.CheckBox("Permissions", CurPermission.Checked, new { ID = CurPermission.PermissionId}) + " " + CurPermission.PermissionValue%>
<br />
<%
}
%>
<input type="submit" value="Submit" />
<%
Html.EndForm();
%>
and the controller,
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult EditPermissions(String[] Permissions)
{
foreach (var CurPermission in Permissions)
{
Debug.WriteLine(CurPermission);
}
return View();
}
Obviously I need to know which boxes are not checked as well as the ones that are. But in the return values because of the whole ("true,false") I cant work out which value relates to which checkbox.
Any suggestions as to a fix or prehaps an alternate method would be appriciated.