More in this section

Forums / Developing with Sitefinity / Dynamically Create Multi-Column Menu

Dynamically Create Multi-Column Menu

10 posts, 0 answered
  1. Dawn
    Dawn avatar
    37 posts
    Registered:
    17 Sep 2012
    19 Jul 2009
    Link to this post
    I want to create a multi-column menu like the one here. Is this possible? What should be my approach?

    Robert
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2009
    Link to this post
    Hello Robert,

    You can create two group pages - let's say "Products" and "Gifts". Each of this group pages will have two pages:

    Products - Group Page                    
    - Books
      - b1
      - b2
      - b3
    - Music
      - m1
      - m2
      - m3

    Gifts - Group Page

    - Personal
      - p1
      - p2
      - p3
    - Corporate
      - c1
      - c2
      - c3

    Since you are going to use CmsSiteMapProvider each child item that you are creating for Books, Music, Personal, corporate will be automatically added. Additionally you can use Repeater in the <ItemTemplate> that is bound to the RadMenu it.

    Greetings,
    Ivan Dimitrov
    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. Dawn
    Dawn avatar
    37 posts
    Registered:
    17 Sep 2012
    20 Jul 2009
    Link to this post
    Thanks for the reply. Can I just use the repeater alone or will it have to be a combination of both the repeater and CmsSiteMapProvider?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2009
    Link to this post
    Hi Robert,

    You can use the repeater separately, but you should bound it to the datasource. The easiest way is working without the repeater and style the menu items.

    Regards,
    Ivan Dimitrov
    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.
  5. Dawn
    Dawn avatar
    37 posts
    Registered:
    17 Sep 2012
    21 Jul 2009
    Link to this post
    I am trying to use the CmsSiteMapProvider but I am still stuck. Here is my radMenuControl

    1 <telerik:RadMenu ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1"
    2     <Items> 
    3         <telerik:RadMenuItem Text="TopMenuItem"
    4  
    5             <Items> 
    6  
    7                 <telerik:RadMenuItem CssClass="topItem"
    8  
    9                     <ItemTemplate> 
    10  
    11                         <div class="customMenuSection"
    12  
    13                          
    14  
    15                         </div> 
    16  
    17                     </ItemTemplate> 
    18  
    19                 </telerik:RadMenuItem> 
    20  
    21             </Items> 
    22  
    23             </telerik:RadMenuItem> 
    24  
    25     </Items> 
    26 </telerik:RadMenu> 

    My code:

    1 protected void Page_Load(object sender, EventArgs e) 
    2     { 
    3  
    4         CreateMenuTemplate(); 
    5     } 
    6  
    7 private Panel CreateMenuTemplate() 
    8     { 
    9         Panel panel1 = new Panel(); 
    10         CmsSiteMapProvider mapProvider = (CmsSiteMapProvider)SiteMap.Provider; 
    11  
    12  
    13         foreach (CmsSiteMapNode node in mapProvider.RootNode.GetAllNodes()) 
    14         { 
    15                         
    16             CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode; 
    17             if (currentNode != null && currentNode.ParentNode != null
    18             { 
    19                 HyperLink link = new HyperLink(); 
    20                 link.Text = node.CmsPage.Title; 
    21                 link.NavigateUrl = node.CmsPage.StaticUrl; 
    22                 link.CssClass = "parentItem"
    23                 if (currentNode.HasChildNodes) 
    24                 { 
    25                     foreach (CmsSiteMapNode node in mapProvider.RootNode.ChildNodes) 
    26                     { 
    27                         HyperLink link2 = new HyperLink(); 
    28                         link2.Text = node.CmsPage.Title; 
    29                         link2.NavigateUrl = node.CmsPage.StaticUrl; 
    30                         link2.CssClass = "childItem"
    31  
    32                     } 
    33                     panel1.Controls.Add(link2); 
    34                 } 
    35                 panel1.Controls.Add(link); 
    36             } 
    37  
    38              
    39         }   
    40   
    41         return panel1; 
    42     } 

    I am not sure how to move from here. Nothing is showing up on my menu.





  6. Dawn
    Dawn avatar
    37 posts
    Registered:
    17 Sep 2012
    22 Jul 2009
    Link to this post
    I finally got something to show up but I am stuck. Can anyone give any advice as to whether or not I am going in the right direction?

    1 <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" /> 
    2 <telerik:RadMenu ID="RadMenu1" runat="server" > 
    3     <Items> 
    4         <telerik:RadMenuItem Text="Top Menu Item"
    5  
    6             <Items> 
    7  
    8                 <telerik:RadMenuItem CssClass="topItem"
    9  
    10                     <ItemTemplate> 
    11  
    12                         <div class="customMenuSection"
    13  
    14                          
    15  
    16                         </div> 
    17  
    18                     </ItemTemplate> 
    19  
    20                 </telerik:RadMenuItem> 
    21  
    22             </Items> 
    23  
    24             </telerik:RadMenuItem> 
    25  
    26     </Items> 
    27 </telerik:RadMenu> 


    1 protected void Page_Load(object sender, EventArgs e) 
    2     { 
    3          
    4  
    5         RadMenu1.Items[0].Items[0].Controls.Add(CreateMenuTemplate()); 
    6          
    7     } 
    8  
    9 private Panel CreateMenuTemplate() 
    10     { 
    11          
    12          
    13         CmsSiteMapProvider mapProvider = (CmsSiteMapProvider)SiteMap.Provider;    
    14         Panel sectionContainer = new Panel(); 
    15         int i = 1
    16         foreach (CmsSiteMapNode node1 in mapProvider.RootNode.GetAllNodes()) 
    17         { 
    18                          
    19             CmsSiteMapNode currentNode = SiteMap.CurrentNode as CmsSiteMapNode; 
    20             if (node1.PageType == CmsPageType.Group) 
    21             { 
    22                 Panel sectionPanel = new Panel(); 
    23                 Panel panel1 = new Panel(); 
    24                 sectionPanel.CssClass = "panelGroup"
    25                 HyperLink link = new HyperLink(); 
    26                 link.Text = node1.CmsPage.Title; 
    27                 link.NavigateUrl = node1.CmsPage.StaticUrl; 
    28                 link.CssClass = "parentItem"
    29                 panel1.Controls.Add(link); 
    30                 sectionPanel.Controls.Add(panel1); 
    31                  
    32                 if (node1.HasChildNodes) 
    33                 { 
    34                     foreach (CmsSiteMapNode node2 in node1.GetAllNodes()) 
    35                     { 
    36                         HyperLink link2 = new HyperLink(); 
    37                         if (node2.PageType == CmsPageType.Normal) 
    38                         { 
    39                             link2.Text = node2.CmsPage.Title; 
    40                             link2.NavigateUrl = node2.CmsPage.StaticUrl; 
    41                             link2.CssClass = "childItem"
    42                         } 
    43                         panel1.Controls.Add(link2); 
    44                     } 
    45  
    46                 } 
    47                 sectionContainer.Controls.Add(sectionPanel); 
    48                 sectionContainer.CssClass = "sectionContainer"
    49                 panel1.CssClass = "menuPanel"
    50             } 
    51              
    52              
    53             i++; 
    54         } 
    55          
    56         return sectionContainer; 
    57          
    58         RadMenu1.DataSource = mapProvider
    59         RadMenu1.DataBind(); 
    60     } 








  7. Steve Lombardi
    Steve Lombardi avatar
    1 posts
    Registered:
    23 Jul 2009
    24 Jul 2009
    Link to this post
    Hello

    Is it possible in Sitefinity to produce a left nav and a top nav...BOTH that appear dynamically in the sitemap, which can then be arranged to a client's liking?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    28 Jul 2009
    Link to this post
    Hello Steve Lombardi,

    Is it possible in Sitefinity to produce a left nav and a top nav...BOTH that appear dynamically in the sitemap, which can then be arranged to a client's liking?

    All navigation controls that use CmsSiteMapProvider are dynamically populated. I am not sure what do you mean by "client's liking".

    Kind regards,
    Ivan Dimitrov
    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.
  9. Dave
    Dave avatar
    1 posts
    Registered:
    31 Jul 2006
    17 Dec 2009
    Link to this post
    Is it possible to create a navigation like the example mentioned here (with columns) in Sharepoint, but also displaying the next level down - so essentially the items on your example dropdown would become headings, with their sub-pages listed underneath?

    Thanks

    Dave
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    17 Dec 2009
    Link to this post
    Hi Dave,

     The RadControls for ASP.NET AJAX work in MOSS, so you should be able to create similar control. You can tale a look at the following article - Integrating RadControls in MOSS


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
10 posts, 0 answered