RadMenu Customization
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 'Show
in navigation ' option is false .
Could you please help me
Thank you
Roopesh
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
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
Hello Ivan,
Could you please tell me how can I hide a menu item?
I am using sitemap datasource
Thank you
Roopesh