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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:19:21+00:00 2026-06-12T07:19:21+00:00

We are using MVC 3 to build a Web site with dynamic menu options

  • 0

We are using MVC 3 to build a Web site with dynamic menu options so that users only see menu options (action Links) that they are allowed to see based on group and individual privileges.

How can we add dynamic menu options (links to partial views) at run time?
Do we hard code all the links of all the partial views and turn of the ones that are not required using a visibility option?
Can we add the links dynamically from a database?

Let me clarify.
WE have admins that have access to all menu options like Manage Users, Manage Groups, Manage Suppliers, Manage products and Manage Orders.
We have regular sales staff who only need Manage Supliers and Manage Orders.
So based on this we only need to show the links that say Manage Orders and Manage Supplier. Hence they dynamic nature of the links I am trying to set up.
We have the permissions set up in the DB.

Jawahar

  • 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-06-12T07:19:22+00:00Added an answer on June 12, 2026 at 7:19 am

    I found a way of doing this using Method extension with IPrincipal

    public static bool IsAllowed(this IPrincipal p, string menuid) { 
    if (p.Identity.IsAuthenticated) { 
             //Code here to verify privillegs against Database
         } 
         return false; 
    } 
    
    This would keep it fairly neat in you Layout.cshtml. 
    
    @if (User.IsAllowed("menuchoice1")) { 
            <a href="@Url.Action(...)">...</a> 
    } 
    @if (User.IsAllowed("menuchoice2")) { 
          <a href="@Url.Action(...)>...</a> 
    } 
    

    Hope this help others looking for similar options

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

Sidebar

Related Questions

I've just recently started to build a web site using ASP.NET - MVC 4,
I'm using the Web Deployment Tool to build and release an MVC site from
At my company we're about to build a new site using ASP.NET MVC. My
After publishing a new build of my ASP.NET MVC web application, I often see
Google Chrome version (8.0.552.224 (Official Build 68599)) I have developed a web site using
Im new to WF and i'm trying to build an asp.net MVC web site
I'm trying to write a build script for a ASP.NET MVC 3 web site
I am developing an MVC application using nHibernate; running through VS's built in web
All, I have a PHP Web application built using Zend Framework and MVC with
2 questions: Does using MVC make it any easier to build 508/WAI compliant sites?

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.