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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:45:35+00:00 2026-05-13T10:45:35+00:00

I have a list of asp.net menu items: <asp:Menu ID=Menu1 runat=server OnLoad=Menu1_Load> <Items> <asp:MenuItem

  • 0

I have a list of asp.net menu items:

<asp:Menu ID="Menu1" runat="server"  OnLoad="Menu1_Load">
    <Items>
        <asp:MenuItem Text="Create Member" Value="Create Member" NavigateUrl="~/create-member.aspx"></asp:MenuItem>
        <asp:MenuItem Text="Edit Member" Value="Edit Member" NavigateUrl="~/edit-member.aspx"></asp:MenuItem>
        <asp:MenuItem Text="Result Export" Value="Result Export" NavigateUrl="~/result-export.aspx"></asp:MenuItem>
        ...
        ...
    </Items>
</asp:Menu>

How can I highlight and remove hyperlink for the currently selected MenuItem?

This is the modified version of Josh’s answer (we don’t need to set the navigateUrl):

        foreach (MenuItem menuItem in Menu1.Items)
        {
            if (Request.PhysicalPath == Server.MapPath(menuItem.NavigateUrl))
            {
                menuItem.Selected = true;
                menuItem.Selectable = false;
                break;
            }
        }
  • 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-13T10:45:35+00:00Added an answer on May 13, 2026 at 10:45 am

    If you are looking to do this server-side based on the page being visited, you’ll just need to make that evaluation, then find the related item and set the NavigateUrl property to “”. Depending on your CSS settings you might also need to assign a specific class to modify the appearance and give the user some visual feedback of their location.

    Edit
    Probably the best way to do this is to use your Menu1_Load event to test the page URL against the NavigateUrl. If there’s a match, remove the NavigateUrl setting. If you weren’t using the ~ to establish the root, I might use:

    foreach (var menuItem in Menu1.Items)  
    {  
        if (Request.Path == menuItem.NavigateUrl)
        {
            menuItem.NavigateUrl = "";
            // Add any CSS modifications here
            break;
        }
    }
    

    To be absolutely sure, you could compare the physical paths:

    foreach (var menuItem in Menu1.Items)  
    {  
        if (Request.PhysicalPath == Server.MapPath(menuItem.NavigateUrl))
        {
            menuItem.NavigateUrl = "";
            // Add any CSS modifications here
            break;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in an asp.net page I have a list of Link buttons: <asp:LinkButton ID=LinkButton1 runat=server
I have an ASP.NET repeater that shows a list of items with a delete
I have a list menu in Asp.net MVC Razor engine Masterpage. While trying some
I have the list box control (ASP.NET Control On aspx page, language C# ).
I am using the asp.net mvc with the Entity Framework. I have a list
I have an ASP.NET WebService that returns an object of List public class Students
I have an asp.net page which is returning a list of object as a
I have an asp.net UserControl that writes HTML content from a SharePoint list to
I have an ASP.NET 3.5 page with a gridview databound to a generic list
We have an ASP.Net page that uses a checkbox to toggle between a list

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.