More in this section

Forums / Developing with Sitefinity / sitemapdatasource - menu question

sitemapdatasource - menu question

2 posts, 0 answered
  1. Chris
    Chris avatar
    6 posts
    Registered:
    18 Jun 2007
    16 Sep 2008
    Link to this post
    Hello,

    I have a menu bound to the sitemapdatasource. I'd like to add an external link to the menu in one of the submenus(dropdown).  is there a way to do this?

    Thanks.
  2. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    19 Sep 2008
    Link to this post
    Hello Alex,

    I would suggest you add the item programatically in the handler of OnItemDataBound event like this:

    .ascx
    <asp:SiteMapDataSource ID="SitemapDataSource1" runat="server" ShowStartingNode="false" /> 
    <telerik:RadMenu ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1" OnItemDataBound="RadMenu1_ItemDataBound">   
    </telerik:RadMenu> 

    ascx.cs
    public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) 
        { 
            if (e.Item.Text == "Home"
            { 
                RadMenuItem NewItem = new RadMenuItem(); 
                NewItem.Text = "Telerik"
                NewItem.NavigateUrl = "http://www.telerik.com/"
                //Adds the item to the Items collection of the parent item 
                e.Item.Items.Add(NewItem); 
            } 
            ... 

    Please note that the example above is for RadMenu for ASP.NET AJAX and not for classic RadMenu.

    Do let us know if you need any further assistance.

    Kind regards,
    Pepi
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
2 posts, 0 answered