Custom Navigation
Hi all,
Here is a code sample that I am trying to convert to use the configuration from the navigation page. The code is written in such a way to only use the Top Level pages. I want it to pick up the "All Pages Under Particular Page" and "Custom selection of Pages" How do I modify the code below to do this?
<%@ Control Language="C#" AutoEventWireup="true" %>
<telerik:RadTabStrip ID="RadPanelpageNav" runat="server" Visible="false" />
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SiteMapDataSource" >
<HeaderTemplate>
<ul class="page-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" />
You could use a RadPanelBar?
Probably, not sure that is the real problem. I think the real issue lies around <DataSourceID="SiteMapDataSource">
I want to get the information from the configuration, not the SiteMap.
I am new with this and may be way off base.
Thanks.
Where can I find more information on creating custom navigation controls? This thread has been here for a while and I am not getting any "real" answers. Thanks to the other users, but can I get some input from a Telerik resources?
Next questions.
Is there Navigation.Manager object?
Is that how I get to the navigation configuration data?
I downloaded the SDK, but it says it isn't licensed. How do I get a license. It won't extract the examples.
Hi Tom Miller,
You can bind any of the suitable RadContorls - TreeView, PanelBar, TabStrip, Menu etc (ones that support hierarchical data representation) to our SitefinitySiteMapDataSource control, which is responsible for handling all the necessary logic cocerning pages that are marked as ShowInNavigation = false, page permissions, group pages etc. The control can be configured to output the whole frontend sitemap, but also supports standard SiteMapDataSource features like StartingNodeOffset, StartFromCurrentNode, StartingNodeUrl etc. If none of the above functionality suits you you can easily create you own datasource to bind your control to by using our Pages API.
Please find below a sample tree navigation using the above mentioned SitefinitySiteMapDataSource and RadTreeView:
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="sfMap" %>
<
sfMap:SitefinitySiteMapDataSource
runat
=
"server"
ID
=
"SitefinitySiteMapDS"
ShowStartingNode
=
"false"
/>
<
telerik:RadTreeView
runat
=
"server"
ID
=
"RTV1"
DataSourceID
=
"SitefinitySiteMapDS"
></
telerik:RadTreeView
>
Tom -
Check out the CleanNav control in the marketplace. It's free and you can configure it to list pages below the currently opened page, or a selected page.
Thanks,
Chris
Tom has a very specific question here that has not been answered.
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="HomepageDropdown.ascx.cs" Inherits="SitefinityWebApp.NavigationTemplates.HomepageDropdown" %>
<
div
style
=
"clear:both"
>
<
telerik:RadTabStrip
ID
=
"RadPanelbarNav"
runat
=
"server"
Visible
=
"false"
/>
<
telerik:RadTreeView
runat
=
"server"
ID
=
"RTV1"
DataSourceID
=
"SiteMapDataSource"
></
telerik:RadTreeView
>
<
asp:SiteMapDataSource
runat
=
"server"
ID
=
"SiteMapDataSource"
StartingNodeOffset
=
"0"
ShowStartingNode
=
"false"
/>
<
asp:Repeater
ID
=
"Repeater1"
runat
=
"server"
DataSourceID
=
"SiteMapDataSource"
>
<
HeaderTemplate
>
<
ul
class
=
"nav-holder"
>
</
HeaderTemplate
>
<
ItemTemplate
>
<
li
>
<
a
id
=
"A1"
href='<%# Eval("Url") %>' runat='server'>
<%#Eval ("Title") %>
</
a
>
</
li
>
</
ItemTemplate
>
<
FooterTemplate
>
</
ul
>
</
FooterTemplate
>
</
asp:Repeater
>
</
div
>
Hi Trevor,
Please note that a template in the real sense of it is just the presentation part of the control, in other words a template which contains a control able to represent data and a datasource control is actually a complete widget, and selecting it as a template to any control would do not much than save you a couple of minutes registering it as a standalone widget, as it will actually override the control datasource with its own declaratively added SiteMapDataSource
. If you want to create a template for the Sitefinity navigation widget you can simply declare any control capable of displaying hierarchical data on an ascx file and then specify it in the Design options of the Navigation widget - then the datasource will be determined by the settings you perform in the navigation widget designer and will be displayed by the control you've added to the template. By default we're using SitefinitySiteMapDataSource control in our Navigation widgets which differs from the ASP.NET SiteMapDataSource in many aspects regarding Sitefinity page permissions, group page behavior etc, so I'd recommend you use that control instead if you'll be developing custom Nav controls.
Kind regards,
Boyan Barnev
the Telerik team