Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 476721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T00:31:06+00:00 2026-05-13T00:31:06+00:00

Ok, I have a role based permission system in place and would like admin’s

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T00:31:06+00:00Added an answer on May 13, 2026 at 12:31 am

    Here are some snippets of code that we use to assign members to a project, hopefully this helps you out!

    In the view we have:

    <p>
        <label>
           Select project members:</label>
        <ul>
            <% foreach (var user in this.Model.Users)
               { %>
            <li>
                <%= this.Html.CheckBox("Member" + user.UserId, this.Model.Project.IsUserInMembers(user.UserId)) %><label
                    for="Member<%= user.UserId %>" class="inline"><%= user.Name%></label></li>
            <% } %></ul>
    </p>
    

    In the controller we have:

    // update project members   
    foreach (var key in collection.Keys)    
    {   
        if (key.ToString().StartsWith("Member"))
        {
            int userId = int.Parse(key.ToString().Replace("Member", ""));   
            if (collection[key.ToString()].Contains("true"))    
                this.ProjectRepository.AddMemberToProject(id, userId);
            else
                            this.ProjectRepository.DeleteMemberFromProject(id, userId);
        }
    }
    

    The main thing to remember when working with the Html Checkbox Helper is to use contains() to determine true or false.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In our application we have implemented role-based forms authentication. This has been handled using
I'm trying to set up role-based Security with permissions. I'm trying to do this
From what i have read from this paper I understand that a role based
I have a controller like this : @Secured(['ROLE_USER','IS_AUTHENTICATED_FULLY']) def userprofile(){ def user = User.get(springSecurityService.principal.id)
Can iPhone apps have role based login? In my application I have to display
I'm working on role-based security implementation in LDAP and Java. Specifically, I have the
I am using Djangos default authentication system (django.contrib.auth) and I would like to add
I am thinking about ways to create a Role Based Access Control system in
I have some question: How to make a role based web application? Such as
The system I am currently working on requires some role-based security, which is well

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.