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

Forums / Developing with Sitefinity / RadMenu Customization

RadMenu Customization

4 posts, 0 answered
  1. Roopesh
    Roopesh avatar
    39 posts
    Registered:
    29 Oct 2010
    10 Aug 2011
    Link to this post
    Hello,

    I have a RadMenu  in my Sitefinity 4.1 application

    <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
    <telerik:RadMenu  EnableSelection="true" ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1">

    Here I want to display only the main menu items. Don't want to display any sub items. And also I want to hide a page group if its ' ' option is false .

    Could you please help me

    Thank you
    Roopesh
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Aug 2011
    Link to this post
    Hello Roopesh,

    Subscribe for ItemDataBound event of the menu.

    There you can use the fulent API to get the root item and hide the other.

    var homeId = Config.Get<PagesConfig>().HomePageId;
                var pgs = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(n=> n.PageId == homeId).Get().OrderByDescending(t => t.Title).Reverse();


    Inside ItemDataBound you have instance to PageNode - from e.Item.DataItem. The PageNode has a property ShowInNavigation that you can use to see if the page should be visible or not.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Roopesh
    Roopesh avatar
    39 posts
    Registered:
    29 Oct 2010
    10 Aug 2011
    Link to this post
    Hello Ivan,

    I created the user control as you said  but I am getting error on pageid

     protected void RadMenu1_ItemDataBound(object sender, Telerik.Web.UI.RadMenuEventArgs e)
        {
            var homeId = Config.Get<PagesConfig>().HomePageId;
            var pgs = App.WorkWith().Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).Where(n => n.
    PageId
    == homeId).Get().OrderByDescending(t => t.Title).Reverse();
            
        }

    I am using the following namespaces

    using System;
    using System.Linq;
    using System.Web.UI;
    using Telerik.Sitefinity;
    using Telerik.Sitefinity.Configuration;
    using Telerik.Sitefinity.Fluent.Pages;
    using Telerik.Sitefinity.Modules.Pages.Configuration;
    using Telerik.Sitefinity.Pages.Model;
    using Telerik.Web.UI;
    If you want more information please let me know . Can you please give a good tutorial to deal with the Radmenu server side events


    Thank you
    Roopesh
  4. Roopesh
    Roopesh avatar
    39 posts
    Registered:
    29 Oct 2010
    10 Aug 2011
    Link to this post
    Hello Ivan,

    Could you please tell me how can I hide a menu item?
    I am using sitemap datasource
    Thank you
    Roopesh
4 posts, 0 answered