Nav - all pages under current PLUS parent?
I have a vertical Left-hand Nav(LHN) that is set to "All pages under particular page". I need it to show the primary parent page in that list as well.
ie: Currently shows:
Subpage1
SubsubpageA
Subpage2
Subpage3
Need it to show:
ParentPage
Subpage1
SubsubpageA
Subpage2
Subpage3
Can this be done very easily?
Hi Nikolei,
You can achieve this by selecting Top-level pages (and their child-pages if template allows) option of the Sitefinity navigation in its designer.
Regards,That would show all top-level items though. I only want to show the single top level parent that groups whatever page you're on.
Dear Nik
I am not sure if I got your idea right.
I wanted once to just display the top level page as kind of breadcrumb stlye. I used this .ascx. Maybe this is a starting point
.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="SubNaviTitle.ascx.cs" Inherits="SitefinityWebApp.UserControls.SubNaviTitle" %>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
Text
=
"Home"
CssClass
=
"SubNaviTitle"
></
asp:Label
>
using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
using
System.Web.UI;
using
System.Web.UI.WebControls;
using
Telerik.Sitefinity.Web;
using
Telerik.Sitefinity.Modules.Pages;
namespace
SitefinityWebApp.UserControls
public
partial
class
SubNaviTitle : System.Web.UI.UserControl
protected
void
Page_Load(
object
sender, EventArgs e)
var actualNode = SiteMapBase.GetActualCurrentNode();
if
(actualNode !=
null
)
while
(actualNode.ParentNode !=
null
&& actualNode.ParentNode.Title !=
"Pages"
)
actualNode = actualNode.ParentNode
as
PageSiteNode;
Label1.Text = actualNode.Title;
else
Label1.Text =
" "
;
Hello guys,
Praise to Markus for the informative resource. I think I achieved the result using the Built in Navigation without Modifying it. I created the page node Hierarchy as described ( view images attached.) then in the navigation I selected "Custom selection of pages", selected the one I want and gave it a template - Horizontal with drop down menus. It produced the result in the second image.
Regards,
Ivan D. Dimitrov
Telerik
Dear Ivan
Can you make an example with two navigations
Main Naviation would have Test, 111, 211 shown (horizontal only top level
Secondary navigation - when you click on 211 it would show 222, 121, 122
As per your screenshots
And when you click on 212 it still shows 211, 222 (open wiht 222) 121, 122
This is my most often uses scenario splitting the navigation in main and secondary as seen in these examples.
Preferable out of the box.
www.golf-winterberg.ch/golfpark
www.baumgartner-gartenbau.ch/bioteiche
grandag.ch.mserver3.arvixevps.com/.../
sternen-rafz.ch.mserver4.arvixevps.com/restaurant
Markus
Hi Markus,
Following your directions I was able to achieve the requested result with only one Nav widget. Please see the screenshots attached. I find this a good way to get to the goal with the out of the box widget.
Regards,
Ivan D. Dimitrov
Telerik
Thanks Ivan
I realy don't get it. Handpicking the pages means (unless I am wrong)
a) you need to have a template for each main menu item
b) if you add a page you need to go back and add that page to custom selection
If a) or b) is true I rather stick to my radControl Sitemap StartingNode offset method.
Markus
Hi Markus,
You are correct - B is true. As you can add the navigation I have demonstrated to a template, you do need to add every newly created page to it if you want it to show. So far this is the most functionality our out of the box Navigation presents.
Regards,Incase it's of any help to anyone, I came up with my own solution. By adding the following JS, it injects the title of the primary parent page ontop of the 2ndary navigation.
// Inject primary parent name in LHN
if
(jQuery(
".sfSel"
).html() != undefined)
activeNavParent = jQuery(
".sfSel"
).html().replace(
'<span class="k-icon k-i-arrow-s"></span>'
,
''
);
activeNavParentUrl = jQuery(
".sfSel"
).attr(
"href"
);
lhnMenu = jQuery(
".leftnav ul.sfNavTreeview"
);
if
(lhnMenu != undefined)
lhnMenuContent = lhnMenu.html();
lhnMenuContent =
'<li class="k-item k-first lhnparent"><a href="'
+ activeNavParentUrl +
'" class="lhnparentlink">'
+ activeNavParent +
'</a><ul>'
+ lhnMenuContent +
'</ul></li>'
;
lhnMenu.html(lhnMenuContent);
//lhnMenu.prepend('<li class="k-item k-first"><a href="' + activeNavParentUrl + '">' + activeNavParent + '</a></li><ul>');
//lhnMenu.append('</ul>');
Dear Nik
Thanks' for sharing.
Yes I would love to have the option to choose - All pages under current top page (whithout top page) as an default option.
Or at least let us be able to set an datasource.
Markus
I am having the same problem with Sitefinity trying to build a menu that is common in most CMS.
Using JS is not an option. Creating a custom widget for a standard behavior seems too much effort. Inserting the menu widget to a page every time I create a new page isn't an option either. It takes just way to much time and prone to failure.
Is there no way to use the Sitefinity standard features to have a left menu showing "childs from the current top level page"?
Forgive me if you have already tried this or if this option was already described above. I didn't read everything but have you tried the ShowParentPage on theadvanced options tabe of the navigation widget? (Attached Image) Then you can create/change the widget template to included Parent Item template as shown on Documentation Link?
<
ParentItemTemplate
>
<
li
>
<
a
id
=
"A1"
runat
=
"server"
href
=
"javascript:void(0);"
><%# Eval("Title") %></
a
>
</
li
>
</
ParentItemTemplate
>
I guess your sample is referring to include the parent item.
But the issue is to show "All Childs of the Current Top-Parent".
Without the need to insert the menu on every page we create and without using a custom widget.
The attached fake screen capture shows how the left menu should look like.
It shows all child menu pages (including their sub-pages) from the CURRENT TOP PARENT menu item.
Is this doable with Sitefinity without a custom widget, Javascript, or adding the menu to any new page?
Hi all,
@Sebastian
The scenario you require is available out of the box. Simply add a Navigation widget to the template your pages are using. On the navigation widget select the "All pages under currently opened page" option. This will achieve the needed result. Here is a video demonstration for further reference.
Regards,
Ivan D. Dimitrov
Telerik
I am trying to figure out how to do this right now. I have a template for interior pages with a navigation widget on the side. Since there are quite a few top level pages I would really like to avoid having to create a separate template for each top level page. My situation is almost identical to the "menu-fake" image you posted. So selecting all pages under a particular page is not an option, because that would require a new template for every top level page in the nav. And selecting all top level pages, while dynamic, still shows all siblings of the current top level page. Have you, or anyone else here, found a way to do this without writing a custom widget?
Hi all,
@Ethan
This scenario will require a custom navigation control as it basically combines the functionality of our "Top-level pages" and our "All pages under currently opened page" navigation options. I can recommend you go through this blog post describing how to create a mega menu in Sitefinity. Additionally you can use our Pages API in order to bind the set of nodes you require along with any conditions on when they should display to a control of your chosing (I can recommend you use a RadPanelBar).
Regards,
Ivan D. Dimitrov
Telerik
In the 3.7 versions we had the StartingNodeOffset property, which reduced custom dev and mutliple templates. Any plans to roll this out in future versions?
Related post:
http://www.sitefinity.com/developer-network/forums/general-discussions-/startingnodeoffset-in-sitefinity-navigation