SelectedStyles do not work with Jeff Prosise's SQL Sitemap provider

Last post 05-11-2007 4:09 AM by Kestrel42. 2 replies.

Sort Posts:

  • SelectedStyles do not work with Jeff Prosise's SQL Sitemap provider

    05-08-2007, 4:41 AM
    • Member
      237 point Member
    • Kestrel42
    • Member since 07-22-2005, 3:27 PM
    • Posts 63

    I'm using Jeff's SQL based site map as described in this article: http://msdn.microsoft.com/msdnmag/issues/06/02/WickedCode/default.aspx

    It's a great improvement on the web.sitemap file, but I've discovered that the menus no longer indicate which is the current node. Any suggestions how to fix that?

    I have the following code in my Master Page:

    <asp:Menu ID="Menu1" runat="server" SkinID="Menu1" DataSourceID="SiteMapDataSource1" StaticSubMenuIndent="">

    <StaticMenuStyle CssClass="Menu_StaticMenu" />

    <StaticMenuItemStyle CssClass="Menu_StaticMenuItem" />

    <DynamicHoverStyle CssClass="Menu_DynamicHover" />

    <StaticSelectedStyle CssClass="Menu_StaticSelected" />

    <DynamicSelectedStyle CssClass="Menu_DynamicSelected" />

    <DynamicMenuItemStyle CssClass="Menu_DynamicMenuItem" />

    <StaticHoverStyle CssClass="Menu_StaticHover" />

    </asp:Menu>
  • Re: SelectedStyles do not work with Jeff Prosise's SQL Sitemap provider

    05-11-2007, 3:57 AM

    Hi,

    I think the problem may be the menu's MaximumDynamicDisplayLevels property is set too small.

    Actually, I don't think I understand your problem more clearly, if you can, please provide more information.

    Amanda Wang
    Microsoft Online Community Support

    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
  • Re: SelectedStyles do not work with Jeff Prosise's SQL Sitemap provider

    05-11-2007, 4:09 AM
    • Member
      237 point Member
    • Kestrel42
    • Member since 07-22-2005, 3:27 PM
    • Posts 63

    My problem is that ASP.Net does not include the necessary CSS tags to distinguish the selected items on the menu.

    I have since developed this "workround" - but don't really understand why it is necessary.

     protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)
        {
            SiteMapNode smn = SiteMap.CurrentNode;
        
            string item = e.Item.NavigateUrl;
            bool Selected = false;
            if (smn0 != null)
            {
                Selected = smn.Url.Equals(item, StringComparison.CurrentCultureIgnoreCase);
            }
            e.Item.Selected = Selected;
        } 

     

Page 1 of 1 (3 items)