Custom Navigation Control
Hi need to develop a custom Navigation control. I tried to develop one and what i get is :
Template (NavigationControl.ascx)
<%@ Control Language="C#" %>
<%@ Register TagPrefix="sfFields" Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.Fields" %>
<%@ Register TagPrefix="sf" Namespace="Telerik.Sitefinity.Web.UI" Assembly="Telerik.Sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<div runat="server" id="controlWrapper">
<telerik:RadMenu ID="siteMapControl" runat="server">
</telerik:RadMenu>
</div>
---- o don't know if this it's ok.
(Control).cs
namespace Test.NavigationControls
class NavigationControlCustom : NavigationControl
protected override string LayoutTemplateName
get
return customTemplate;
protected override void InitializeControls(GenericContainer container)
base.InitializeControls(container);
private const string customTemplate = "Test.NavigationControls.Resources.NavigationControl.ascx";
If i configure the widget in the toolbox and put it in one page i get the menu.
What I need to do is :
- get only the top level pages
- to apply a diferent Class to each top level page
In other custom menu (vertical menu) i will need to get all children pages of the current/selected top level page.
Hello JV,
- You can filter by root node by using the PageManager and then bind your RadMenu control
var manager = PageManager.GetManager();
var noodes = manager.GetPageNodes().Where(c =>c.Parent.Id == "FrontEndSiteMapID").ToList();
- Each top level page will be RadMenuItem which has CssClass property that you can set inside ItemDataBound method of the RadMenu control for which you can subscribe in your custom class.
Kind regards,
Ivan Dimitrov
the Telerik team
Hello Ivan ,
Can you please tell me how can I show only the top menu items. I am using the following code
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" />
<telerik:RadMenu EnableSelection="true" ID="RadMenu1" runat="server"
DataSourceID="SitemapDataSource1" onitemdatabound="RadMenu1_ItemDataBound" >
</telerik:RadMenu>
Thank You
Roopesh