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

Forums / Bugs & Issues / Custom Navigation Questions

Custom Navigation Questions

29 posts, 0 answered
  1. Jonathan
    Jonathan avatar
    9 posts
    Registered:
    02 Jun 2005
    19 Apr 2011
    Link to this post
    I have a custom navigation template like the following.

    <%@ Control Language="C#" AutoEventWireup="true" %>
    <telerik:RadTabStrip ID="RadPanelbarNav" runat="server" Visible="false" />
      
    <asp:Repeater  ID="Repeater1" runat="server" DataSourceID="SiteMapDataSource" >
        <HeaderTemplate>
            <ul class="nav-holder">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                    <a href='<%# Eval("Url") %>' runat='server'>
                        <h3><%#Eval ("Title") %></h3>
                        <p><%# Eval("Description") %></p>
                    </a>
                </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
      
    <asp:SiteMapDataSource runat="server" ID="SiteMapDataSource" StartingNodeOffset="0" ShowStartingNode="false" />



    How can I make this work so that when I select "do not show in navigation" under the page options the page will not show up in the custom navigation. It seems that the idatasource ignores this option.
  2. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    22 Apr 2011
    Link to this post
    Hello Jonathan,

    By default SitemapDataSource will return all nodes and then you can filter the ones who are marked not to be shown in Navigation from the code-behind. For more information on how to achieve this you can refer to the sample code I've attached.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Sitefinity;
    using Telerik.Sitefinity.Web;
     
    namespace SitefinityWebApp.Controls
    {
        public partial class WebUserControl1 : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
              Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBound);
              Repeater1.DataBind();
                 
            }
     
            void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
     
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
     
                    var data = e.Item.DataItem as PageSiteNode;
                    if (data != null)
                    {
     
                        if (data.ShowInNavigation == false)
                        {
                            e.Item.Visible = false;
                        }
                    }
                }
            }
        }
    }
    If you need any further assistance with this implementation, please write back.

    All the best,
    Boyan Barnev
    the Telerik team

  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    11 Jul 2011
    Link to this post
    Hey Boyan,
      How would you implement this with a RadPanelBar?  I'm noticing that if you hide items on ItemDataBound you get undesirable results

    Lets say you have a structure like this

    - Parent
       - Child

    If the Child gets visible set to false like the code you defined because of show-in-navigation being false...then the PanelBar Parent still has the Expand\Collapse arrows like it has Children.

    (see attached)

  4. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    11 Jul 2011
    Link to this post
    Hello Steve,

    Yes, you are right on that one. In this case I'd recommend you to get  alist of pages using the Fluent/native API and then pass this list as a DataSource to PanelBar. In the filter expression you can get only these pages that have ShoInNavigation == true. For more information o how to bind the RadPanelBar to this list of pages, please take a look at this article from our documentation.

    Greetings,
    Boyan Barnev
    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
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    12 Jul 2011
    Link to this post
    Thanks Boyan,

    What am I missing here?

    protected void Page_Load(object sender, EventArgs e) {
        var pages = App.WorkWith()
           .Pages()
           .ThatArePublished()
           .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
           .Where(p => p.ShowInNavigation == true)
           .OrderBy(p => p.Ordinal)
           .Get();
     
        navPanelBar.DataSource = pages;
        navPanelBar.DataBind();
    }

    <telerik:RadPanelBar ID="navPanelBar" runat="server"
        Skin="OCFP"
        EnableEmbeddedSkins="false"
        DataFieldParentID="ParentId"
        DataFieldID="Id"
        DataTextField="Title"
        OnItemDataBound="OnPageNode_ItemDataBound"
        AllowCollapseAllItems="false"
        MaxDataBindDepth="5"
        Width="256px">
        <ExpandAnimation Type="None" />
        <CollapseAnimation Type="None" />
    </telerik:RadPanelBar>

    It's not rendering anything...if I use "LocatedIn"...and the attached image is what I get if I remove the LocatedIn line

  6. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    14 Jul 2011
    Link to this post
    Hi Steve,

    Actually the problem seems to be in the DataSource that you're binding the PanelBar to. When you declare DataFieldParentID="ParentId" in the PanelBar template it's expecting to receive all PageNodes with ParentId property different from null. However, if you filter only pages .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend) this would construct the list without the "Pages" root node (it's the same as specifying .GetPageNodes().Where(pN => pN.RootNode.Id == SiteInitializer.FrontendRootNodeId). What you can do if filter out the Backend PageNodes and the Backend RootNode in the lambda expression. Please refer to the below sample:

    public partial class PanelBarCustom : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                var source = App.WorkWith().Pages()
                    //.LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
                                           .ThatArePublished()
                                           .Where(p => p.ShowInNavigation == true && p.IsBackend == false && p.Id != SiteInitializer.BackendRootNodeId)
                                           .Get()
                                           .ToList();
     
                PanelBarControl.DataSource = source;
                PanelBarControl.DataTextField = "Title";
                PanelBarControl.DataFieldID = "Id";
                PanelBarControl.DataFieldParentID = "ParentId";
                PanelBarControl.DataBind();
                 
                        
            }
        }
    and ascx:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PanelBarCustom.ascx.cs" Inherits="SitefinityWebApp.Controls.PanelBarCustom" %>
    <telerik:RadPanelBar runat="server" ID="PanelBarControl" ></telerik:RadPanelBar>

    I hope this helps you achieve the desired functionality. If any problems persist, please do not hesitate to contact us again.

    All the best,
    Boyan Barnev
    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
  7. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    14 Jul 2011
    Link to this post
    Ahhh I figured it much be something like that :)  My next step was to just get "Pages" as the starting node.

    I am curious though...is this a Fluent Bug?...or current limitation

    I mean...
    .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend) == p.IsBackend == false
    Right?...are they not the same thing?

    Here's what I'm saying....when I tell it I just want the frontend pages with .LocatedIn()...I would ASSUME that SiteInitalizer.BackendRootNodeID wouldn't be taken into effect since I just told it I want only front-end pages.

    Perhaps another method to wrap this "p.Id != SiteInitializer.BackendRootNodeId" ?  Or an override on LocatedIn?
  8. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    14 Jul 2011
    Link to this post
    Hello Steve,

    Yes, you are right - .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend) is not the same as p.IsBackend == false as it will still leave out the "Backend" root node in the PageNodes list, that's why I'm excluding it additionally with p.Id != SiteInitializer.BackendRootNodeId. However this is not an API limitation for sure, maybe I didn't express myself properly in the previous post - the problem is coming from the fact that when you declare a DataFieldParentID property (which you definitely need, otherwise you'll get a flat structure of the current pages) you need to have the FrontendRootNodeId present in the list since it's the ParentId of all Frontend pages, that's why applying the .LocatedIn filter returns an empty PanelBar - it cannot bind itself to a list of pages that are missing the ParentId.

    Kind regards,
    Boyan Barnev
    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
  9. Daniel L
    Daniel L avatar
    26 posts
    Registered:
    06 May 2006
    23 Oct 2011
    Link to this post
    I attempted the same DataBound method that Boyan suggested in an earlier post. I had problems filtering out unpublished pages, and found this newer post (http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/unpublished-page-showing-up-in-custom-navigation-after-4-2-upgrade.aspx) that recommends using the SitefinitySiteMapDataSource control. This solved all my problems with trying to create a custom navigation control.

    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="navcontrols" %>
     
    <telerik:RadPanelBar runat="server" ID="SitemapPanelbar" DataSourceID="SiteMapDataSource" Width="180px" Skin="Simple" ></telerik:RadPanelBar>
     
    <navcontrols:SitefinitySiteMapDataSource ID="SiteMapDataSource" runat="server" StartingNodeOffset="1" ShowStartingNode="false"  />
  10. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    23 Oct 2011
    Link to this post
    I am trying to figure out how to use the "user" configuration / selected pages from the Navigation editor.  But unfortunately knows how to do this.  Is the source code available so I can research how the built in navigation stuff works?
  11. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    24 Oct 2011
    Link to this post


    Hello Tom Miller,

    Can you please let us know what is the ultimate result you want to achieve? I'm asking because it woud be very simple if you just specify the datasource through our built-in navigation control (i.e. select the custom range of pages to be included) and then use your own template for that control, which would allow you to represent it as per your desired functionality. Please do not hesitate to let us know if the functionality you demand differs from what I've offered. Just in case I'm attaching a short video demonstrating how to apply and external template to the Navigation widget in Sitefinity, hope you might find it useful.

    Greetings,
    Boyan Barnev
    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
  12. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    24 Oct 2011
    Link to this post
    I want to use the Navigation control settings with a custom navigator layout / css.   I got what I wanted with doing a lot of messing around with css, but assume I did it the hard way.

    I am using the Simplicity free skin.  The custom navigation is only for the top level pages.  This is fine for the front page, but I want a similarly looking navigation else where. 

    Secondly, is there a way to register these custom navigation as controls, or selections from the available menu options so I don't have to have non tech users figure out a long path name to stick in just the right places.

    I am new with Sitefinity and looking to learn as much as I can.

    Thanks.
  13. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    25 Oct 2011
    Link to this post
    Hi Tom Miller,

    Thank you for the clarification. Using an external template for the navigation is the easiest way to achieve this in terms of development efforts, as you're using the built-in designer of the navigation control, and are simply specifying how to represent the selected data on the frontend. However, it's possible to create a completely separate user controls with their custom logic and register them as widgets in the toolbox like the others. For more information you can check this article from our online documentation.

    Best wishes,
    Boyan Barnev
    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
  14. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    29 Oct 2011
    Link to this post
    HI,
    Thanks for the info.  The thing I am still missing is how to create a template for a navigation control.  I found this article, but there no built in template for navigation. 

    http://www.sitefinity.com/blogs/joshmorales/posts/11-05-10/mapping_external_templates_for_sitefinity_4_widgets.aspx

    Any chance you could provide a simple example one for me?
    Thanks.
  15. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    31 Oct 2011
    Link to this post
    I tried this and it didn't work.  I don't have to worry about sub-level menus.
  16. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    31 Oct 2011
    Link to this post
    Hello Tom Miller,

    Can you please elaborate on "I tried this and it didn't work.  I don't have to worry about sub-level menus." Do you mean that you have followed the steps described int he sample video I provided several replies ago, and if so, can you please let me know of the issues you have experienced?

    Greetings,
    Boyan Barnev
    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
  17. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    31 Oct 2011
    Link to this post
    Sorry I wasn't more specific

    #1 - I used some example code from the internet and yours in this thread about hiding a menu item that is no marked "ShowInNavigation".  So that is the part that "isn't working"

    #2 - Still looking for a good example of an external template for Navigation.  I found a blog post that the best way to start is to grab it from an existing widget.  There aren't any existing widgets for Navigation, so I am not sure where to start.  If by an external template, you mean an ascx file, I have that, but it is clearly not using the Navigation Widget settings.  Actually it is the example above.  It is what the "Simplicity" skin uses (except it doesn't check for "ShowInNavigation").

    Thanks.
  18. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    31 Oct 2011
    Link to this post
    Hi Tom Miller,

    Thank you for the clarification. By inspecting the Simplicity skin navigation control template, it looks like it should take into account the navigation control settings for its top level navigation (the one consisting of RadTabStrip, strange though why its Visibility is set to false), however its lower part the Repeater has its own datasource. This datasource is formed by SiteMapDatasource control, which indeed does not take into account the ShowInNavigation property of Sitefinity pages. However, you can easily convert it to using our SitefinitySiteMapDataSource control like this:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
    <sfMap:SitefinitySiteMapDataSource runat="server" ID="SitefinitySiteMapDS"  ShowStartingNode="false" />
     
    <telerik:RadTabStrip ID="RadPanelbarNav" runat="server" Visible="false" />
      
    <asp:Repeater  ID="Repeater1" runat="server" DataSourceID="SitefinitySiteMapDS" >
        <HeaderTemplate>
            <ul class="nav-holder">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                    <a href='<%# Eval("Url") %>' runat='server'>
                        <h3><%#Eval ("Title") %></h3>
                        <p><%# Eval("Description") %></p>
                    </a>
                </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    Generally, here's how the logic goes - if you will be using a template for the Navigation widget, this means that you already have the DataSource  logic ocvered by the widget settings, all you need to do is provide a suitable control to represent that data (any control that supports hierarchical databinding is fine). A simple navigation control template could be even the one-liner:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <telerik:RadTabStrip ID="RadTabStrip1" runat="server" />
    This would take all the data set from the navigation widget, and display it in TabStrip.

    When you create a standalone navigation control, on the other hand, you will need to declare a datasource for your control, as it's not just a template anymore. For these scenarios we highly recommend usage of our
    SitefinitySiteMapDataSource as it already has all the necessary logic inside - ShowInNavigation, Security, etc. So the template from the above example can be easily converted to a standalone widget that can be registered and dropped on any Sitefinity page by including the following:
    <%@ Control Language="C#" AutoEventWireup="true" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
    <sfMap:SitefinitySiteMapDataSource runat="server" ID="SitefinitySiteMapDS"  ShowStartingNode="false" />
    <telerik:RadTabStrip ID="RadPanelbarNav" runat="server" DataSourceID="SitefinitySiteMapDS"/>
    The most important thing to keep in mind is that when you create a template for our Navigation control you need to take care of the presentation part only, i.e. how the data will be rendered on the page, since the control takes care of the datasource.

    All the best,
    Boyan Barnev
    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
  19. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    03 Nov 2011
    Link to this post
    Thanks so much.  Having a problem with one item

    Object reference not set to an instance of an object.


    <p><%# Eval("Description") %></p>

    Can you point me to a page describing the API for Navigation Page objects.  So I can get a good list of Members and methods?  What is the right member for the "Description" field.

    Thanks.
  20. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    04 Nov 2011
    Link to this post
    Here is a detailed stack trace.  I didn't look at it before, but it looks like there is a bug "
    Telerik.Sitefinity.Web.PageSiteNode.get_Description"


    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Sitefinity.Web.PageSiteNode.LoadPageData() +553
       Telerik.Sitefinity.Web.PageSiteNode.get_Description() +15
    
    [TargetInvocationException: Property accessor 'Description' on object 'Telerik.Sitefinity.Web.UI.NavigationControls.SitefinitySiteMapDataSource+InnerPageSiteNode' threw the following exception:'Object reference not set to an instance of an object.']
       System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component) +7829885
       System.Web.UI.DataBinder.GetPropertyValue(Object container, String propName) +273
       System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts) +142
       ASP.app_data_sitefinity_websitetemplates_simplicity_widgettemplates_navigation_mainnavigation_ascx.__DataBind__control5(Object sender, EventArgs e) in c:\inetpub\wwwroot\cpcug\App_Data\Sitefinity\WebsiteTemplates\Simplicity\WidgetTemplates\Navigation\MainNavigation.ascx:15
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +304
       System.Web.UI.Control.DataBindChildren() +11413863
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
       System.Web.UI.Control.DataBindChildren() +11413863
       System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +321
       System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) +185
       System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) +627
       System.Web.UI.WebControls.Repeater.OnDataBinding(EventArgs e) +167
       System.Web.UI.WebControls.Repeater.EnsureDataBound() +84
       System.Web.UI.WebControls.Repeater.OnPreRender(EventArgs e) +20
       System.Web.UI.Control.PreRenderRecursiveInternal() +113
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Control.PreRenderRecursiveInternal() +222
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4201
  21. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    07 Nov 2011
    Link to this post
    Hello Tom Miller,

    Actually the SitefinitySiteMapDataSource control provides datasaource of type PageSiteNode, which does not have the Description property directly exposed (even if it did, the actual Description you're setting from the Sitefinity UI is a property of the PageData object in the node). We'll need to modify slightly the provided template so we can include a codebehind file and access the PageSiteNode in the ItemDataBoud event of the repeater. There we'll get the PageNode corresponding to that PageSiteNode, and access the PageData object in it. Now it's safe to get the Description and display it in your template using a compatible control (for example, I've used  a Label control). Please take a look at the below modification to the template and a screenshot of its functionality:
    template:
    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Simplicity.ascx.cs" Inherits="SitefinityWebApp.ControlTemplates.Navigation.Simplicity" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
    <sfMap:SitefinitySiteMapDataSource runat="server" ID="SitefinitySiteMapDS"  ShowStartingNode="false" />
      
    <telerik:RadTabStrip ID="RadPanelbarNav" runat="server" Visible="true" />
       
    <asp:Repeater  ID="Repeater1" runat="server" DataSourceID="SitefinitySiteMapDS" >
        <HeaderTemplate>
            <ul class="nav-holder">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                    <a id="A1" href='<%# Eval("Url") %>' runat='server'>
                        <h3><%#Eval ("Title") %></h3>
                        <p><asp:Label runat="server" ID="descrLbl"></asp:Label></p>
                    </a>
                </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Sitefinity.Pages.Model;
    using Telerik.Sitefinity.Web;
    using Telerik.Sitefinity.Modules.Pages;
    using Telerik.Sitefinity.Data;
     
    namespace SitefinityWebApp.ControlTemplates.Navigation
    {
        public partial class Simplicity : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBound);
            }
     
            void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
                    var item = e.Item.DataItem as PageSiteNode;
                    var pageManager = PageManager.GetManager();
                    PageNode pageNode;
                    using (new ElevatedModeRegion(pageManager))
                    {
                        pageNode = pageManager.GetPageNode(item.Id);
                    }
                    Label descrLabel = e.Item.FindControl("descrLbl") as Label;
                    if (descrLabel != null && pageNode.Page != null)
                    {
                        descrLabel.Text = pageNode.Page.Description.ToString();
                    }
                }
            }
        }
    }
    screenshot:


    I'm also attaching the sample control to this reply. If there's anything else we can help you with, please let us know.

    Regards,
    Boyan Barnev
    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
  22. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    08 Nov 2011
    Link to this post
    As you can see it isn't picking up the description value from the page.  I now know why "visible" is set to false, the skin doesn't want the tabs showing.  It seems like there must be a better control to base this off of. 

    I haven't set this up as a control yet, just want to get the raw version working first then turn it into a widget.  So I removed this bit of code: Inherits="SitefinityWebApp.ControlTemplates.Navigation.Simplicity" %>


  23. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    10 Nov 2011
    Link to this post
    Hello Tom Miller,

    Let me elaborate a little bit on the modification that were done to the template, so you can get the idea better:
    By default this template will use SiteMapDataSource which is fine, however it will just take the whole SiteMap and render it in your Navigation. Like we discussed earlier, the problem is coming from the fact that asp:SiteMapDataSource does not address the ShowInNavigation property and the permission set of Sitefinity Pages. That's why we have developed our SitefinitySiteMapDataSource control, which takes care of the above logic out of the box. So once we substitute the SiteMapDataSource with SitefinitySiteMapDataSource in the template, we'll need to modify the default functionality <%#Eval ("Description") %> as this will no longer work - the output type of SitefinitySiteMapDataSource is PageSiteNode, and the actual description of a Sitefinity page is stored in the Description property of the PageData object located inside the PageSiteNode. For that purpose we have introduced an asp:Label control on your template which replaces the <%#Eval ("Description") %> code. Then we need to have a codebehind file where we can execute certain server-side logic that will get the PageData object from the PageSiteNode supplied by SitefinitySiteMapDataSource and will set dynamically the label for each node.
    In conclusion, there is no way for the template to display the correct Description, without the codebehind file where the actual logic for setting this value to the Label is executed. You can still use the full set I've sent you - the template and its codebehind as a widget template and as a standalone widget, it's up to your preference.

    Regards,
    Boyan Barnev
    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
  24. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    10 Nov 2011
    Link to this post

    That is what I did.  I also had to set the CssClass="navigation" for the navigation widget , which I didn't have to do before.  The three files affecting this are below.  here is the website: http://71.191.139.2/cpcug

    MainNavigation.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MainNavigation.ascx.cs" %>
    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
    <sfMap:SitefinitySiteMapDataSource runat="server" ID="SitefinitySiteMapDS"  ShowStartingNode="false" />
        
    <telerik:RadTabStrip ID="RadPanelbarNav" runat="server" Visible="false" />
         
    <asp:Repeater  ID="Repeater1" runat="server" DataSourceID="SitefinitySiteMapDS" >
        <HeaderTemplate>
            <ul class="main-nav-holder">
        </HeaderTemplate>
        <ItemTemplate>
                <li>
                    <a id="A1" href='<%# Eval("Url") %>' runat='server'>
                        <h3><%#Eval ("Title") %></h3>
                        <p><asp:Label runat="server" ID="descrLbl"></asp:Label></p>
                    </a>
                </li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>

    MainNavigation.ascx.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using Telerik.Sitefinity.Pages.Model;
    using Telerik.Sitefinity.Web;
    using Telerik.Sitefinity.Modules.Pages;
    using Telerik.Sitefinity.Data;
       
    namespace SitefinityWebApp.ControlTemplates.Navigation
    {
        public partial class Simplicity : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
                Repeater1.ItemDataBound += new RepeaterItemEventHandler(Repeater1_ItemDataBound);
            }
       
            void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
                    var item = e.Item.DataItem as PageSiteNode;
                    var pageManager = PageManager.GetManager();
                    PageNode pageNode;
                    using (new ElevatedModeRegion(pageManager))
                    {
                        pageNode = pageManager.GetPageNode(item.Id);
                    }
                    Label descrLabel = e.Item.FindControl("descrLbl") as Label;
                    if (descrLabel != null && pageNode.Page != null)
                    {
                        descrLabel.Text = pageNode.Page.Description.ToString();
                    }
                }
            }
        }
    }

    layout.css
    body {
        padding:0;
        margin:0;
        font-size: 12px;
        font-family: Arial, Helvetica, sans-serif;
        background-color: #333;
        color: #757575;
    }
      
    .main-body {
        background-color: #151515;
        color: #757575;
    }
      
    a img {
        border:0;
    }
      
    #wrapper{
        position:relative;
        float: left;
        width: 1050px;
        margin-left: -500px;
        left: 50%;
    }
    #top {
        width: 100%;
        margin-top: 20px;
        margin-bottom: 20px;
    }
      
    div.navigation {
        position:relative;
        float: left;
        width: 100%;
        height: 50px;
        background-color: black;
        border-bottom: 4px solid #39a5d4
    }
      
    div.navigation ul.main-nav-holder {
        list-style: none;
        padding: 0px;
        margin: 0px;    
        position: relative;
        float: left;
        width: 100%;
        border-bottom: 1px solid #61b7dd;
        height: 50px;
    }
      
    div.navigation ul.main-nav-holder li {
        position: relative;
        float: left;
        width: 175px;
    }
    div.navigation ul.main-nav-holder li a{
        display: block;
        padding-left: 10px;
        padding-right: 10px;
        padding-top: 3px;
        height: 51px;
        margin-top: 0px;
        text-decoration: none;
        border-right: 2px solid #1f1f1f;
    }
    div.navigation ul.main-nav-holder li a:hover h3{
        color: #39a5d4;
    }
      
    div.navigation  ul.main-nav-holder li a:hover p{
        color: #ccc;
    }
      
    div.navigation ul.main-nav-holder li a h3{
        font-size: 14px;
        padding: 2px;
        margin: 0px;
        font-weight: bold;
        color: white;
    }
      
    div.navigation ul.main-nav-holder li a p {
        color: #808080;
        font-size: 11px;
        margin-top: 4px;
    }
      
    div.NavigationHorz {
        position:relative;
        float: left;
        width: 100%;
        height: 40px;
        background-color: black;
        margin-bottom: 15px;
    }
      
    div.NavigationHorz ul.rtsUL {
        list-style: none;
        padding: 0px;
        margin-bottom: 20px;    
        position: relative;
        float: left;
        width: 100%;
        height: 40px;
    }
      
    div.NavigationHorz ul li.rtsLI {
        position: relative;
        float: left;
        width: 175px;
        text-align: left;
    }
      
    div.NavigationHorz ul li.rtsLI a{
        display: block;
        padding-left: 0px;
        padding-right: 0px;
        padding-top: 12px;
        margin: 0px;
        font-size: 14px;
        font-weight: bold;
        color: white;
        text-decoration: none;
        text-align: left;
        background-color: black;
        border-right: 2px solid #1f1f1f;
    }
      
    div.NavigationHorz ul li.rtsLI a:hover {
        color: #39a5d4;
    }
      
    div.NavigationVert ul.rtsUL {
        list-style: none;
        padding: 0px;
        margin: 0px;    
        position: relative;
        height: 100%;
        width: 275px;
        border-top: 3px solid #1f1f1f;
        background-color: black;
    }
      
    div.NavigationVert ul li.rtsLI {
        position: relative;
        height: 100%;
        border-right: 4px solid #39a5d4;
    }
    div.NavigationVert ul li.rtsLI a{
        display: block;
        padding-left: 0px;
        padding-right: 10px;
        padding-top: 6px;
        height: 24px;
        margin: 0px;
        font-size: 14px;
        font-weight: bold;
        color: white;
        text-decoration: none;
        text-align: left;
        background-color: black;
        border-bottom: 3px solid #1f1f1f;
    }
    div.NavigationVert ul li a:hover{
        color: #39a5d4;
    }
      
    div.NavigationFooter {
        position: relative;
        display: block;
        float: left;
        height: 25px;
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 20px;
    }
      
    div.NavigationFooter ul.rtsUL {
        list-style: none;
        padding: 0px;   
        position: relative;
        float: left;
        width: 100%;
    }
      
    div.NavigationFooter ul li.rtsLI {
        position: relative;
        width: 150px;
        float: left;
        text-align: center;
    }
      
    div.NavigationFooter ul li.rtsLI a{
        padding-left: 0px;
        padding-right: 0px;
        margin: 0px;
        font-size: 12px;
        font-weight: bold;
        color: #39a5d4;
        text-decoration: none;
        text-align: center;
    }
      
    div.NavigationFooter ul li.rtsLI a:hover {
        color: white;
    }
      
    #content, #footer {
        position:relative;
        float:left;
        width: 100%;
    }
      
    #content{
        margin-top: 36px;
    }
      
    #content .sfContentBlock h1 {
        font-size:30px;
        margin-top: 0px;
        line-height: 35px;
        margin-bottom: 20px;
        color: white;
        letter-spacing: -2px;
        border-bottom: 1px solid #222;
        padding-bottom: 15px;
    }
      
    #content .sfContentBlock p {
        line-height: 20px;
        font-size: 12px;
        color: #7a7a7a;
    }
      
    #content .sidebar {
      
    }
      
      
    .RadSiteMap_sidebar, .RadSiteMap_sidebar ul {
        position:relative;
        float:left;
        width: 100%;
        line-height: 24px;
    }
      
    .RadSiteMap_sidebar {
        border-right: 1px solid #1f1f1f;
    }
      
    .RadSiteMap_sidebar ul{
        width: 90%;
    }
    .RadSiteMap_sidebar ul ul{
        width: 100%;
    }
      
    .RadSiteMap_sidebar .rsmLevel a.rsmLink {
        color: #3ba7d6;
        font-size: 14px;
        letter-spacing: -1px;
        font-weight: bold;
        margin: 0px;
        padding: 0px;
        border-bottom: 1px solid #1f1f1f;
        text-indent: 5px;
    }
    .RadSiteMap_sidebar .rsmLevel a.rsmLink:hover {
        color: #888;
    }
      
    .RadSiteMap_sidebar .rsmLevel1 {
        margin-bottom: 25px !important;
    }
      
    .RadSiteMap_sidebar .rsmLevel1 .rsmItem {
        border-bottom: 1px solid #1f1f1f;
    }
      
    .RadSiteMap_sidebar .rsmLevel1 .rsmItem a{
        font-size: 11px;
        text-indent: 0px;
        color: #757575;
        letter-spacing: normal;
        font-weight: normal;
    }
    .RadSiteMap_sidebar .rsmLevel1 .rsmItem a:hover{
        color: #0071c0;
    }
      
    #footer {
        border-top:3px solid #2f2f2f;
        padding-top: 20px;
        margin-top: 30px;
        padding-bottom: 20px;
    }
      
    #footer h1 {
        margin: 0px;
        padding: 0px;
        color: #fff;
    }
      
    #footer {
        color: #757575;
    }
      
    #footer p {
        margin-top: 3px;
        border-bottom: 1px dotted #666;
        padding-bottom: 15px;
    }
      
    .sfContentBlock strong {
        color: #fff;
    }
      
    a{
        color: #0071c0;
        text-decoration: none;
    }
      
      
    .blog-list {
        list-style:none;
        padding: 0px;
        position:relative;
        float:left; 
        padding-right: 20px;
        border-right: 1px solid #333;
        margin: 0px;
    }
      
    .blog-post {
        margin-bottom: 35px;
        position: relative;
        float: left;
        width: 100%;
        padding-bottom: 35px;
        border-bottom: 1px solid #202020;
    }
      
    .blog-date-and-author {
        position: relative;
        float:left;
        width: 150px;
        line-height: 23px;
        font-size: 11px;
        color: #999;
        text-indent: 10px;
    }
      
    .blog-title-and-summary {
        position:relative;
        float: left;
        width: 490px;
      
    }
      
    .blog-date {
        position:relative;
        float:left;
        width:138px;
        height:23px;
        background-image: url(../Images/blog_date.jpg);
        font-size: 12px;
        color: #fff;
        text-indent: 10px;
        font-weight: bold;
        line-height: 23px;
    }
      
    .blog-title-and-summary h2.post-title {
        line-height: 22px;
        font-size: 18px;
        font-weight: bold;
        letter-spacing: -1px;
        margin: 0px;
        padding: 0px;
        margin-bottom: 20px;
    }
      
    .post-summary {
        line-height: 20px;
        color: #757575;
    }
      
    .events-list {
        list-style: none;
        padding: 0px;
        margin: 0px;
        position:relative;
        float:left;
        border-right: 1px solid #333;
    }
      
    .events-list .event {
        position:relative;
        float: left;
        width: 100%;
    }
      
    .event-date {
        position:relative;
        float:left;
        text-align: right;
        color: #757575;
        font-size: 11px;
        width: 150px;
        padding-right: 20px;
    }
      
    .event-title-and-summary {
        position: relative;
        float:left;
        width: 460px;
        padding-left: 20px;
        border-left: 1px solid #333;
        margin-bottom: 40px;
        color: #757575;
        font-size: 11px;
    }
      
    .event-dates {
        font-size: 18px;
        font-weight: bold;
        color: #fff;
    }
      
    h2.event-title {
        font-size: 18px;
        padding: 0px;
        margin: 0px;
        letter-spacing: -1px;
    }
      
    h1.sfeventTitle, h1.sfpostTitle {
        color: white;
    }
      
    .event-summary {
        font-size: 12px;
        line-height: 18px;
        padding-top: 25px;
    }
      
    h2.event-title a:hover{
        color: #fff;
    }
      
    .sfContentBlock h3 {
        border-bottom: 1px solid #444;
        padding-bottom: 5px;
        margin-bottom: 5px;
        letter-spacing: -1px;
        color: #fff;
    }
      
    ul.sftaxonHorizontalList {
        padding: 0px;
        margin: 0px;
        list-style: none;
    }
      
    ul.sftaxonHorizontalList li{
        line-height: 25px;
        border-bottom: 1px solid #444;
    }
      
    .sf_pagerNumeric {
        position: relative;
        float:left;
        width: 100%;
    }
      
    .sf_pagerNumeric a{
        display: block;
        width: 30px;
        height: 30px;
        background-color: #444;
        color: #ccc;
        text-align:center;
        line-height: 30px;
        font-size: 13px;
        font-weight: bold;
        position:relative;
        float:left;
        margin-right: 1px;
    }
      
    .sf_pagerNumeric a:hover{
        background-color: #666;
    }
      
    a.sf_PagerCurrent {
        background-color: #0071c0;
        color: white;
    }
      
    .sfFormInstructions {
        color: #757575;
        line-height: 18px;
    }
      
    .sfFormTitle {
        font-size: 15px;
        letter-spacing: -1px;
    }
      
    .sfTxt {
        border: 1px solid #555;
        background-color: #333;
        padding: 5px;
        width: 90%;
        font-size: 12px;
        color: #fff;
    }
      
    .sfTxt:hover, .sfTxt:focus {
        border: 1px solid #aaa;
    }
      
    .sfTxtLbl {
        font-size: 13px;
        color: #0071c0;
        font-weight: bold;
        line-height: 25px;
    }
      
    .sfFormBox, .sfFormBlock {
        padding-bottom: 15px;
        position:relative;
        width: 100%;
        float:left;
    }
      
    .sfExample {
        color: #757575;
        font-size: 11px;
    }
      
    .sfRadioList input {
          
        position: relative;
        float: left;
    }
    .sfRadioList label {
        display: block;
        line-height: 20px;
        position: relative;
    }
      
    .sfRadioList br {
        display: none;
    }
      
    .sfFormSubmit  {
          
        padding-top: 25px;
    }
      
    .sfFormSubmit input, .sfcommentsSubmitBtnWrp input {
        background-color: #0071c0;
        color: white;
        font-weight: bold;
        font-size: 13px;
        padding: 10px 15px 10px 15px;
        border: 0px;
        font-family: Georgia, "Times New Roman", Times, serif;
    }
      
    .sfError  {
        line-height: 25px;
        background-color: #0071c0;
        color: white;
        font-size: 11px;
        text-indent: 15px;
        position:relative; 
        float:left;
        padding-right: 15px;
        margin-top: 10px;
        margin-bottom: 15px;
    }
      
    .sfcommentsForm {
        border: 0px;
        position:relative;
        float:left;
        width: 100%;
    }
      
    .sfcommentsFieldsList {
        list-style: none;
        padding: 0px;
    }
      
      
    .sfpostContent p, .sfeventContent, .sfeventDatesLocationContacts {
        line-height: 18px;
        color: #757575;
    }
      
    .sfcommentsList {
        line-height: 18px;
        color: #757575;
    }
      
    .sfcommentNumber{
        display: none;
    }
      
    h2#comments, h2.sfcommentsTitle{
        padding-top: 15px;
        border-top: 3px solid #888;
        color: white;
        margin-top: 15px;   
        position:relative;
        float:left;
        width: 100%;
          
    }
      
    li.sfcommentDetails{
        position:relative;
        float:left;
        width: 100%;
        margin-bottom: 25px;
        padding-bottom: 25px;
        border-bottom: 1px solid #333;
    }
      
      
    .ToggleAdvancedToolbars  {
        color: #0071c0;
    }
  25. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    19 Sep 2016
    15 Nov 2011
    Link to this post
    Hi Tom Miller,

    I have inspected the link you provided me with, and indeed it looks like the template has been applied correctly. Would it be possible for you to provide us with a backup of your project database, and an archive of the project files, so we can set it up locally and inspect what might be going on, as the sample's been working fine on our side. Thanks in advance.

    Best wishes,
    Boyan Barnev
    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
  26. Tom Miller
    Tom Miller avatar
    52 posts
    Registered:
    27 Feb 2010
    16 Nov 2011
    Link to this post
    SQL Server isn't my thing (I am an Oracle expert).  Having one of the IT guys work on a backup of the DB.  How would you like me to provide the backup of the site?  zip?  I will put it all on an FTP site and provide you a link(s) privately soon.

    Thanks!
  27. Charles
    Charles avatar
    61 posts
    Registered:
    18 Jul 2012
    25 Jul 2012
    Link to this post
    I have a scenario where I'm making pages not public. If you try opening the pages (when logged out) the pages are not served. Great. 
    I have the following code that gets the pages but I'm not sure how to determine if the user viewing the node has permission. I've applied permissions to pages so I'd like to determine how to not display a node if the user does not have permission

     

     

    try

     

    {

     

     

    RadPanelItem item = e.Item;

     

     

     

    PageSiteNode dataItem = (PageSiteNode)e.Item.DataItem;

     

     

     

    if (!dataItem.ShowInNavigation)

     

    {

     

     

    if (item.Level > 0)

     

    {

     

     

    RadPanelItem pi = (RadPanelItem)item.Parent;

     

    pi.Items.Remove(item);

    }

     

     

    else

     

    {

     

     

    this.PanelBar.Items.Remove(item);

     

    }

     

     

    return;

     

    }

  28. Vakeel
    Vakeel avatar
    19 posts
    Registered:
    13 May 2014
    28 Jan 2015
    Link to this post

    Hi

     I upgraded my application to v7.3 but I am getting error somewhere else. When I visit any page that has Sitefinity Event Calendar on it is throwing an errorTelerik.Web.UI. RadWindowManager with ID= ‘RadWindowManager‘was unable to find embedded skin with name Sitefinity. Please, make sure that you spelled the skin name correctly, or if you want to use a custom skin, set EnableEmbeddedSkins=false.To solve this I have added EnableEmbeddedSkins=”false”  to<telerik:RadWindowManager id="radWindowManager" runat="server" Modal="True" Skin="Sitefinity">

    Line and it worked on development machine, staging server but giving error on production server as belowCannot create an object of type ‘System.Boolean’ from its string representation “false” for “EnableEmbeddedSkins” property.I am not able to work around this. Please suggest a solution.

    Thanks.

  29. Angel Moret
    Angel Moret avatar
    29 posts
    Registered:
    22 Sep 2016
    30 Jan 2015
    Link to this post
    Hi Vakeel,

    We have already answered you in another forum thread:

    http://www.sitefinity.com/developer-network/forums/designing-styling/upgraded-to-7-1---need-help-styling-vertical-menus#6zQTLmDAAkCvFalkmck7Zg
     
    Regards,
    Angel Moret
    Telerik
     
    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 Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
29 posts, 0 answered