Custom Navigation Control

Posted by Community Admin on 03-Aug-2018 16:05

Custom Navigation Control

All Replies

Posted by Community Admin on 25-Nov-2010 00:00

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.



Posted by Community Admin on 25-Nov-2010 00:00

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

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about 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 ,

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

This thread is closed