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 3808002
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:04:46+00:00 2026-05-19T15:04:46+00:00

I have been trying to find a way to access a master page control

  • 0

I have been trying to find a way to access a master page control in order to show/hide a menu option.

In my MP, I have:

   <div id="menucontainer">
        &nbsp;
            <ul id="menu">              
                <li id="menuHome"><%= Html.ActionLink("Home", "Index", "Home")%></li>
                <li id="menuNewHire"><%= Html.ActionLink("New Hire", "Index",     "newHire")%></li>
                <li><%= Html.ActionLink("Software", "Index", "Software")%></li>
                <li><%= Html.ActionLink("Hardware", "Index", "Hardware")%></li>
                <li><%= Html.ActionLink("Telecom", "Index", "Telecom")%></li>
                <li><%= Html.ActionLink("About", "About", "Home")%> </li>

Then a ContentPlaceHolder after that..What I want to do is in the controller, see if a user is in a certain AD group, if so, show or hide one of the menu options. In this case, mnuNewHire I only want to be visible to certain users.

Any ideas on how to do this? Thanks in advance for any and all help.

Geo…

  • 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-19T15:04:47+00:00Added an answer on May 19, 2026 at 3:04 pm

    I would externalize this menu into a separate controller and use Html.Action helper method. So for example you could have a model:

    public class UserModel
    {
        public bool IsNoob { get; set; }
    }
    

    then a controller:

    public class MenuController: Controller
    {
        private readonly IUsersRepository _repository;
        public MenuController(IUsersRepository repository)
        {
            _repository = repository;
        }
    
        public ActionResult Index()
        {
            var username = User.Identity.Name;
            var userModel = new UserModel
            {
                // Maybe you could use the membership provider here
                // just don't know how you are handling authorization
                IsNoob = _repository.GetUserGroup(username) == "Noobs"
            }
            return View(userModel);
        }
    }
    

    and a corresponding partial view:

    <ul id="menu">              
        <li id="menuHome"><%= Html.ActionLink("Home", "Index", "Home")%></li>
        <% if (Model.IsNoob) { %>
            <li id="menuNewHire"><%= Html.ActionLink("New Hire", "Index", "newHire")%></li>
        <% } %>
        <li><%= Html.ActionLink("Software", "Index", "Software")%></li>
        <li><%= Html.ActionLink("Hardware", "Index", "Hardware")%></li>
        <li><%= Html.ActionLink("Telecom", "Index", "Telecom")%></li>
        <li><%= Html.ActionLink("About", "About", "Home")%> </li>
    </ul>
    

    and finally in your master page:

    <div id="menucontainer">
        <%= Html.Action("index", "menu") %>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lately I have been trying to find a way to control applications on my
I have been trying to find a way of getting a windows batch file
I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss]
I've been trying to find a way to do this but, have not found
I have been trying to find a good guide to create a templated control.
I have been researching around trying to find the best way to begin developing
I have been trying to find information on how to retrieve attachments from a
I have been trying to find a code snippet to do an unsharp mask
I have been trying to find out why the following lines of code do
I have been trying to find some resource on this topic for a while

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.