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

  • Home
  • SEARCH
  • 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 8851067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:03:28+00:00 2026-06-14T13:03:28+00:00

I have a default internet application template from MVC4 and I would like to

  • 0

I have a default internet application template from MVC4 and I would like to add some links to the <nav> tag depending on the user logged in.

I.e all the users have a default navigation panel, but if it is an admin logged in, he should have extra link for Managing product stock.

Right now it looks like that(from _Layout.cshtml):

            <nav>
                <ul id="menu">
                    <li>@Html.ActionLink("Home", "Browse", "Product")</li>
                    ...
                </ul>
            </nav>

And I need somehow insert new ActionLink. I’ve tried to make an if statement inside the default layout, but it does not work. How could I add an extra <li> tag inside this <nav>? I am not familiar with JavaScript or JQuery, but can it be done using MVC features?

  • 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-14T13:03:29+00:00Added an answer on June 14, 2026 at 1:03 pm

    Yes this can be achieved using the razor syntax

                <nav>
                    <ul id="menu">
                        <li>@Html.ActionLink("Home", "Browse", "Product")</li>
                        @if( User.IsInRole("Admin") ){
                         <li>@Html.ActionLink("Admin", "...", "...")</li>
                        }
                    </ul>
                </nav>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created application using: Default Web Site >> Right Click >> Add Application
My server have default php version of 4, so when I run some script
I want to be able to have default text like Enter content here... appear
I have some default values for testing my code, but for security reasons those
I am currently trying to add a widget to my application and have been
I would like to create the ability for a user to have opened more
I have a Pyramid application which uses request.environ['REMOTE_ADDR'] in some places. The application is
I have a xulrunner application and I've been trying to reference remote content from
so i have an application which has a default package as com.android . within
In my application i have Tab bar Controller. I want to change default color

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.