1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Expand property for SiteMenu

Expand property for SiteMenu

12 posts, 0 answered
  1. anca
    anca avatar
    5 posts
    Registered:
    10 Nov 2007
    03 Mar 2009
    Link to this post
    Hi,

    is there i can  set the expand property of the SiteMenu to false?
    Thank you
  2. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    03 Mar 2009
    Link to this post
    Hello anca,

    yes you can do that quite easily. Please go to the page or template where your SiteMenu control is located, edit the SiteMenu control and expand "Behavior" panel. Then set the value of "LastExpandLevel" property to -1.

    I hope this will solve your problem. Let us know if there is anything else we can do for you.

    Greetings,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. anca
    anca avatar
    5 posts
    Registered:
    10 Nov 2007
    03 Mar 2009
    Link to this post
    yes, it was quite easy...thank you

    another problem with the menu is that  in mozilla it doesn't work ;some of the links are inactive and others even if they seem active (they show the rollover state) don't take you to the specific page.
  4. anca
    anca avatar
    5 posts
    Registered:
    10 Nov 2007
    03 Mar 2009
    Link to this post
    actually,
    now i see that it doesn't work in both IE and Mozilla
  5. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    03 Mar 2009
    Link to this post
    Hi anca,

    I am glad that had solved your problem.

    I'd like to ask you to open the new questions as a new ticket in the future, because otherwise the ticket response time keeps passing though the original issue has been resolved. Following this practice will ensure that all clients get prompt and high quality assistance. Thank you for your understanding.

    Now, to your second question. SiteMenu is using RadMenu component (you can find out more about it here), which supports all the major browsers (http://www.telerik.com/products/aspnet-ajax/resources/browser-support.aspx). As a matter of fact most of the staff here in Telerik is using Firefox as their browser of choice and we have not experienced any problems.

    The most probable cause of your problems is the custom CSS which can interfere with the menu. I suggest you try out the menu with a default template that comes with Sitefinity and one of the built-in themes. In case you experience problems there, please do let us know - and preferably send us some screenshots. If everything is working as expected, then problem is most probably with your custom CSS. You can use FireBug in Firefox to locate the problem.

    I hope you will find this information helpful. Let us know if there is anything else we can do for you.

    Sincerely yours,
    Ivan
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. anca
    anca avatar
    5 posts
    Registered:
    10 Nov 2007
    04 Mar 2009
    Link to this post
    Hi Ivan,

    yep, something was wrong in my css file. I put the RadMenu and customized it and it all works fine now.

    Thanks
  7. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    I'm adding a SiteMenu control to a master page and am using this code:

    <%@ Register TagPrefix="sf" TagName="SiteMenu" Src="~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx" %>
     
    <sf:SiteMenu runat="server" LastExpandLevel="-1" />

    Adding LastExpandLevel="-1" didn't work.  The sub pages are still showing up on hover.  How do I disable the sub pages from appearing on the site menu control?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    27 Apr 2010
    Link to this post
    Hello Mike Berlin,

    A simple way to accomplish this task is to hook on the OnClientItemOpening event of the menu control and call args.set_cancel(true);, where args is the parameter containing the event's arguments. This will disable the items opening

    <script type="text/javascript">
       function ItemOpening(menu, args)
       {
           args.set_cancel(true);
       }
    </script>


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  9. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    I ended up editing ~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx.  I added the property MaxDataBindDepth="1" which solved the problem.

    Thanks,
    Mike
  10. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    Well, it partially worked.  The problem now is that when I go into a sub page the nav element in the SiteMenu control isn't getting the selected classed.

    Is there a way to get the class 'rmFocued' applied to the nav element in the SiteMenu control when in a child page with a SiteMenu control using MaxDataBindDepth="1" ?

    I also tried your method of adding the javascript below to my master page but it never gets called.
  11. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    Okay, I found out how to hook into the javascript mentioned below and it's now executing.  However, this code isn't preventing the sub pages from appearing on mouse hover:

    args.set_cancel(true);
  12. Mike Berlin
    Mike Berlin avatar
    16 posts
    Registered:
    19 Feb 2010
    27 Apr 2010
    Link to this post
    Found the solution:

    Removed all reference of javascript.  On the master page where I include the SiteMenu control I use this:

    <sf:SiteMenu runat="server" LastExpandLevel="1" />

    And then on the ~/Sitefinity/UserControls/Navigation35/SiteMenu.ascx.cs RadMenu1_ItemDataBound method I used this:

    CmsSiteMapNode currentPage = ((CmsSiteMapNode)SiteMap.CurrentNode);
    CmsSiteMapNode currentNode = ((CmsSiteMapNode)e.Item.DataItem);
     
    if (currentPage.IsDescendantOf(currentNode))
    {
         e.Item.CssClass = "rmFocused";
    }

    Followed by the rest of the code already in the function.  This successfully removes the sub pages from the SiteMenu control (and DOM) and also selects/bolds the SiteMenu item if you are in a sub page of the parent node.

    I hope this helps anyone else who has the same requirement that I had.
Register for webinar
12 posts, 0 answered