Well, I have a role-based permission system, and the administrator should be able to edit permissions for each role. To do this, I need to load a lot of checkboxes, however I'm struggling with getting the returned data from the view
Please note: I looked around, I found similar questions, but so far I can not 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 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 fields are not checked, as well as those that are. But in the return values, because of the integer ("true, false"), I cannot determine which value refers to which flag.
Any suggestions for a fix or proposed alternative method will be assigned.