RadMenu Customization

Posted by Community Admin on 04-Aug-2018 08:41

RadMenu Customization

All Replies

Posted by Community Admin on 10-Aug-2011 00:00

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

Posted by Community Admin on 10-Aug-2011 00:00

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

Posted by Community Admin on 10-Aug-2011 00:00

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

Posted by Community Admin on 10-Aug-2011 00:00

Hello Ivan,

Could you please tell me how can I hide a menu item?
I am using sitemap datasource
Thank you
Roopesh

This thread is closed