More in this section

Forums / Developing with Sitefinity / Mega menu in Version 5.1

Mega menu in Version 5.1

4 posts, 0 answered
  1. SangsG
    SangsG avatar
    4 posts
    01 Apr 2008
    24 Sep 2012
    Link to this post
    We created a custom mega menu in our old site on Sitefinity version 3.7.2096.220:1 and want to convert it for version 5.1.

    Here's the partial code. Please let me know if this could be converted to 5.1.

    Telerik.Cms.CmsManager cmsManager = new Telerik.Cms.CmsManager(); 
            foreach (Telerik.Cms.ICmsPage page in cmsManager.GetPages())
                if (page.PageType == CmsPageType.Group)
                    SiteMapNode node = SiteMap.Provider.FindSiteMapNodeFromKey(page.ID.ToString());

                    if (node != null && SiteMap.CurrentNode != null)
                        if (SiteMap.CurrentNode.IsDescendantOf(node))
                            startingNode = node;

    Are there any examples of mega menu?
  2. MB
    MB avatar
    302 posts
    09 Jan 2005
    25 Sep 2012
    Link to this post
    The easiest way I’ve found to implement a ‘mega’ menu, is to create a user-control that handles the ‘ItemDataBound’ event of a SiteMapNavigationMenu (i.e. a wrapped RadMenu) and specify it as the 'Design-Settings->Custom-Template-Path" option, when setting the properties of a standard navigation control with the page/template editor.

    Then, when the standard navigation control hits the menu level settings you specified (typically that would be level-1) it hands off the ItemDataBound event to the usercontrol you specified as the Custom-Template, from where you get to take full control.

    In the ItemDataBound event handler, you can make choices to load a menu template (e.g. a MegaMenu template) or load standard submenu items.

    Of course, it's not a solution for every situation, but seems to apply for the typical MegaMenu applications.

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MegaMenu.ascx.cs" Inherits="MyTemplates.MegaMenu" %>
    <%@ Register tagprefix="sf" namespace="Telerik.Sitefinity.Web.UI" assembly="Telerik.Sitefinity" %>
    <%@ Register tagprefix="sf" namespace="Telerik.Sitefinity.Web.UI.NavigationControls.SiteMapNavigations" assembly="Telerik.Sitefinity" %>
    <%@ Register tagprefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI" %>
    <sf:SiteMapNavigationMenu id="SiteMapNavigationMenu1" runat="server" skin="Black" />

    using System;
    using System.Linq;
    using System.Web.UI;
    using Telerik.Web.UI;
    using Telerik.Sitefinity.Web.UI.Templates;
    using Telerik.Sitefinity.Web.UI;
    using Telerik.Sitefinity.Web;
    namespace MyTemplates
        public partial class MegaMenu : System.Web.UI.UserControl
            protected void Page_Load(object sender, EventArgs e)
                // Add the Delegate for the ItemDataBound event
                this.SiteMapNavigationMenu1.ItemDataBound += new Telerik.Web.UI.RadMenuEventHandler(SiteMapNavigationMenu1_ItemDataBound);
            // Handle the ItemDataBound event
            protected void SiteMapNavigationMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
                // This is the menu item that fired the event.
                RadMenuItem item = e.Item;
                // Now we can decide between:
                // 1. Insert a 'Mega' template at this point (load and/or construct it)
                // 2. Build the standard sub-menu tree (recursively walk the item's tree)
                // 3. Do some other weird stuff

  3. Kiran
    Kiran avatar
    1 posts
    06 Feb 2014
    29 Apr 2014
    Link to this post

    can u provide sitefinity  megamenu complete code step-by-step.

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    19 Apr 2017
    01 May 2014
    Link to this post

    You can follow this blog post which shows how to create a mega menu in Sitefinity step by step. You can also consider our Pages API documentation, for how to query pages.

    Nikola Zagorchev
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
4 posts, 0 answered