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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:04:48+00:00 2026-05-28T19:04:48+00:00

I have .net mvc3 web site. And i must to implement top menu. Each

  • 0

I have .net mvc3 web site. And i must to implement top menu. Each of the menu tags is lead to his action and display another view.This what i have now:

<ul id="menu">
        <li>@Html.ActionLink("Home", "Index", "Home")</li>
        <li>@Html.ActionLink("Products", "Products", "Home")</li>
        <li>@Html.ActionLink("Pricing", "Pricing", "Home")</li>
        <li>@Html.ActionLink("Our Team", "OurTeam", "Home")</li>
        <li>@Html.ActionLink("Contact Us", "ContactUs", "Home")</li>
</ul><!-- /menu -->

This view is Html.RenderAction("Header", "Home"); in my layout(because it must to appear in all pages)
I need to implement Custom ActionLink. The anchor text must be:

<span>text</span><b>text</b>

The “text” is Home(for example of first li)
And the current ActionLink must add class :”Selected” to the anchor.

How i can do this? Help please

p.s
I can add this menu for each view in my website with “selected” class of current view, but this is not good solution.

  • 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-28T19:04:50+00:00Added an answer on May 28, 2026 at 7:04 pm

    If I understand right you want to put the “selected” class to the current displaying action.
    You can do a check in the view by looking at this:

    HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString()
    HttpContext.Current.Request.RequestContext.RouteData.Values["action"].ToString()
    

    Then you put the “selected” class to your actionlink the way showed in the previous answer

    <li>@Html.ActionLink("Home", "Index", "Home", null, new {@class = ":selected"})</li>
    

    Personally I will create a ViewModel containing a list of “MenuAction” that expose, other than the route values, a bool property “Selected”. Imo from the view will be much more cleaner the handling of the data.

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

Sidebar

Related Questions

Assume we have an ASP.NET MVC3 Web site that makes use of Entity Framework
I have a web site using .NET 4 and ASP.NET MVC3 running in IIS
I have a web site written using ASP.NET MVC3. The site has one single
I have an MVC3 C#.Net web site and I have a lookup table Methods
I have an MVC3 C#.Net project. When I initially load my Web site, I
Consider we have a working computer support incident management web site developed with ASP.NET
I have published an ASP.NET MVC3 site. It runs great. However, looking back at
I have a MVC3 site in .Net 4.0 running on IIS6 with extensionless manner
I am building a big ASP.NET MVC3 web site. I am going to hit
I have a web project using asp.net mvc3. Now clients ask for a security

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.