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

Forums / General Discussions / Adding to SiteMenu Dynamically

Adding to SiteMenu Dynamically

3 posts, 0 answered
  1. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    12 Jun 2009
    Link to this post
    Hello,

    I'm just wondering if it's possible to add a submenu dynamically through code to the sitemenu created in sitefinity. I have a page (and menu item) called practices.aspx and I'd just like to create a submenu of items  that go to the same page (practices.aspx) but have a different query string attached (i.e. ID=1, ID=2 etc).

    Any assistance would be greatly appreciated.
  2. KMac
    KMac avatar
    133 posts
    Registered:
    15 Dec 2008
    12 Jun 2009
    Link to this post
    Nevermind, I was just being dense. Hooked into the RadMenu1_ItemDatabound event and added them there. If there's a better way, please let me know, otherwise, just ignore this post.
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Jun 2009
    Link to this post
    Hello KMac,

    You can add logic on SiteMenu databound event. Here is a sample below:

     public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e)  
        {  
     
            CmsSiteMapNode node11 = e.Item.DataItem as CmsSiteMapNode;  
            if(node11 !=null && Request.QueryString.Equals("?1"))  
            {  
            RadMenuItem item1 = new RadMenuItem();  
            item1.Text = "MyNewlyAddedItem";  
            item1.NavigateUrl = "http://www.sitefinity.com";  
            RadMenu1.Items.Add(item1);  
            }  
     
    .....   
       .... 


    Best wishes,
    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.
Register for webinar
3 posts, 0 answered