Navigation Menu Site Map Difficulties

Discussion in 'ASP .Net Web Controls' started by Allen Racho, Mar 22, 2006.

  1. Allen Racho

    Allen Racho Guest

    Hello, all! Great to find this resource.

    I have an asp:Menu control on a page that gets its data from a SiteMapDataSource (which in turn draws data from a SQL Server). Everything works well, as expected, WRT normal navigation menu operation.

    However, what is the recommended practice -- if there is one -- for easily excluding submenu items so that they don't appear on any menu, but still show up in the SiteMapPath ("breadcrumbs") control?

    Let me provide a concrete example. Here's a snippet of the main menu:

    [Home] [About] [Contact]

    When the user submits a message through the Contact form, one of two results pages are called: Success.aspx or Failure.aspx. In the SiteMap data source, I have made the nodes for these two pages as children of the Contact page node. As such, when called, they appear in the breadcrumb trail as follows:

    Home >> Contact >> Success|Failure

    However, they also annoyingly appear in the dynamic drop-down under the main menu item for Contact!

    You get the idea... So, is there a built-in way to exclude child nodes from appearing under a parent item, but still appear normally in the breadcrumb trail?

    Thanks much!

    Allen Racho, Mar 22, 2006
    1. Advertisements

  2. Ward Bekker

    Ward Bekker Guest

    Hi Allan,

    No Solution for you unfortunately, but I also had that problem once and
    discovered it's not easy to change. I was a bit disappointed about that
    because this is a common scenario.

    Ward Bekker
    "Asp.Net Discussions for the Professional Developer"

    "Free .Net 2.0 C# to/from VB.Net Code Converter"
    Ward Bekker, Mar 23, 2006
    1. Advertisements

  3. Allen Racho

    Allen Racho Guest

    Ward, thanks for the reply. I have actually managed to solve this particular issue by some [read: a lot] of digging around. It involves actively removing items from the menu list (e.g. menu.Items.Remove()) before the menu is rendered. If you want the exact code for this, which appears to work flawlessly (if only for future reference), send me an email at allenrachoATSYMBOLyahooPERIODcom.

    Now however, I have run into a another very annoying issue WRT built-in ASP.NET 2.0 menu. I cannot get the menu to reliably highlight active items appropriately!

    Example top level menu items:

    [Home] [About] [Projects]

    Example child menu items:

    -Privacy Policy
    -Terms of Use

    -Page 1
    -Page 2
    -Page 3

    When selecting the top-level ("parent") menu items, they stay highlighted just fine. Meaning, if you select "Projects", you will land on the Projects page and the appropriate menu item will be highlighted.

    However, if you select "Page 2", you will land on the Projects page, and NOTHING will be highlighted, which is slightly disorienting. Ideally and logically the parent menu item (Projects) should be highlighted to give the user a proper sense of place in the site.

    Right now, I have a solution that works one way or the other. Either I can get all the parent items to appropriately highlight, or I can get the child items to cause their parent menu items to highlight - but suddenly highlighting the parent menu items themselves stops working.

    Any ideas?

    Allen Racho, Mar 24, 2006
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jason Hanks
    Jason Hanks
    Jun 22, 2004
  2. Laurahn
    Steven Cheng[MSFT]
    Feb 6, 2007
  3. Jim

    site map and navigation

    Jim, Jan 14, 2008, in forum: ASP .Net
    Cowboy \(Gregory A. Beamer\)
    Jan 14, 2008
  4. Philip
  5. Dmitry Klymenko
    Richard Creer
    Jan 8, 2007

Share This Page