![]() |
Enterprise Systems »
SharePoint Server »
Custom Controls
Intermediate
License: The Code Project Open License (CPOL)
Navigation Custom Control for Microsoft Office SharePoint Server (MOSS)By Stephen HuenRenders navigational nodes using list tags. |
C#, Windows, .NET2.0, ASP.NET, VS2005, Dev
|
|
Advanced Search Add to IE Search |
|
|
|
||||||||||||||||
For use in Microsoft Office SharePoint Server (MOSS) 2007, this web control is an alternative to the out-of-the-box "Current Navigation" a.k.a. AspMenu. It renders navigational nodes using list tags, like:
The web control uses a PortalSiteMapProvider to render a vertical navigation. Unlike the out-of-the-box AspMenu, it does not emit table tags, but list tags customizable using CSS classes. The navigation expands the root nodes and sibling nodes to the current node and its parent nodes. A node can be a sub-site or a page.
It has several public properties:
SiteMapProvider - A site map provider of type PortalSiteMapProvider. Default is CurrentNavSiteMapProvider.StartNodeKey - Server relative URL for a starting sub-site. For example: /PressReleases/2006. Default is the root site.IncludeSubSites - Include sub-sites? Allowed values are True, False, or PerWeb. Default is PerWeb, i.e., a per sub-site setting, configurable in the Modify Navigation Site Actions menu.IncludePages - Include pages? Allowed values are True, False, or PerWeb. Default is PerWeb, i.e., a per sub-site setting, configurable in the Modify Navigation Site Actions menu.IncludeHeadings - Include headings? Allowed values are True, False.IncludeAuthoredLinks - Include authored links? Allowed values are True, False.MaxLevels - Maximum number of node levels. Default is 0, i.e., no limit.CompactMode - If set to True, the navigation expands the root nodes and all parent nodes to the current node. In the example below, nodes Child1, Child2, and Child3 are the root nodes: Child1
Child2
Child21
Child211 (Current Node)
Child2111
Child3
If set to False, sibling nodes to the current node and its parent nodes will also be shown. For example:
Child1
Child2
Child21
Child211 (Current Node)
Child2111
Child212
Child22
Child23
Child3
Default is False.
ListCssClass - CSS class name for the outermost <ul> tag.NodeCssClass - CSS class name for regular hyperlinked nodes.CurrentNodeCssClass - CSS class name for a selected node.CurrentNodeParentCssClass - CSS class name for the lowest level node under which there is a selected node.NoUrlNodeCssClass - CSS class name for nodes with no URL, like headings.The control also uses a resource file to store all messages and property attribute UI strings. It demonstrates how to develop a custom class that inherits CategoryAttribute or DescriptionAttribute and returns a localized string from your own Resource Manager.
The sample Visual Studio 2008 solution includes all the support files you need to build and deploy this web control, minus strong name key files (*.snk). It contains two projects: Deployment and SharePoint.Publishing. The SharePoint.Publishing project contains source codes for the web control. The Deployment project contains a Solution directory where a WSP file is generated and deployed by a post-build script.
The web control does not fully support site hierarchy containing navigational "headings" because they cannot be clicked to open up child nodes. The navigation will, however, show parent headings if one of the child nodes is a current node.
Using stsadm, install solution file QuestechNavigation.wsp in \Deployments\Solution\:
stsadm -o addsolution -filename QuestechNavigation.wsp
Go to SharePoint Central Administration/Operations/Global Configuration-Solution Management. Deploy the installed solution to the selected web applications. To insert the web control to a publishing page, modify the appropriate master page or page layout as follows:
...
<%@ Register Tagprefix="QuestechPublishingWebControls"
Namespace="QuestechSystems.SharePoint.Publishing.WebControls"
Assembly="QuestechSystems.SharePoint.Publishing.Navigation, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=57d955ce9c425b79" %>
...
...
<QuestechPublishingWebControls:Navigation CompactMode="False" runat="server" />
...
VerticalNavigation to NavigationCompactModeSiteMapProvider, IncludeSubSites, and IncludePages
General
News
Question
Answer
Joke
Rant
Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.
|
PermaLink |
Privacy |
Terms of Use
Last Updated: 24 May 2009 Editor: Deeksha Shenoy |
Copyright 2006 by Stephen Huen Everything else Copyright © CodeProject, 1999-2010 Web20 | Advertise on the Code Project |