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

Forums / General Discussions / Custom Navigation Control

Custom Navigation Control

3 posts, 0 answered
  1. JV
    JV avatar
    74 posts
    Registered:
    15 Jun 2012
    25 Nov 2010
    Link to this post
    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.



  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Nov 2010
    Link to this post
    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
  3. Roopesh
    Roopesh avatar
    39 posts
    Registered:
    29 Oct 2010
    10 Aug 2011
    Link to this post
    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

3 posts, 0 answered