This project is read-only.

Create Your List First

Before you install the Web Part you should create a custom list on your primary site collection, note the list will need to reside in the default lists location in the site collection: http://<your url>/lists/<your list>. You can name the list anything you want, you will be passing the list name to the Web Part in your master page, which will be described below. Here is a list of columns that you will need in your list.

ListColumns.png

The following List Columns are used by the Web Part:

List Column Name Description Field Name Type Additional Info
Title This field is already included in any list by default. LinkTitle Single line of text
Link URL The navigation link. Link_x0020_URL Single line of text
Link Order The order the link will appear in the menu. Link_x0020_Order Number
Show Menu Item Show or hide the menu item. Show_x0020_Menu_x0020_Item Choice Add 2 values: Yes No
Parent Menu The parent menu item. Parent_x0020_Menu Lookup Get Information From: choose <your list name> In this column: choose Title
OpenNewWindow Open link in a new window OpenNewWindow Yes/No


The name of the columns in the list are important because the column names are hard coded in the Web Part. The field name is what really matters here. The Web Part uses CAML queries to reference the fields in the list.

You should add a couple of items to your list so you can see some results once the Web Part is installed and configured in the Master Page. So how do you accomplish security trimming, simple.... You can apply permissions to each list item, slick.

Install The Web Part

After you have created your list, you can now install the Web Part, this is the easy part. Using another excellent tool SharePoint Solution Installer, it was simple to create an installation for the feature:
  • Download the zip file from the download section
  • From a Web Frontend, unzip the zip file you just downloaded
  • Run the setup.exe
  • Keep choosing next until you reach the Web Applications/Site Collections page, click on the desired webapp(s)/site collection(s) where the feature will be installed, then choose next
  • Choose Next, then Close to close out the setup
  • Your feature should be activated but if not, activate your feature from Site Collection Features (Site Actions->Site Settings->Site collection featues, under Site Collection Administration)

You will see a reference to SharePoint 2007 when running the setup, this is because the SharePoint Installer does not fully support SharePoint 2010, but it will install just fine.

Configure The Master Page

So now we have to add the Web Part to the Master Page. Using SharePoint Designer, open up your Master Page. I find the split view in SPD the easiest, so you can see the code and the design on one page. After opening your master page, you will need to register the assembly. At the top of the master page you will see several assembly declarations, we need to register the assembly so we can use it in the Master Page. Head to the end of the declaration section just before the first HTML tag and add this line:

<%@ Register TagPrefix="spNav" Namespace="spNavMenu2010" Assembly="spNavMenu2010, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e7d947ded56689ec" %>

MasterPageRegister.png

Next we can add the Web Part to the Master Page. We are going to replace the top menu, but the Web Part can be configured as a side menu/vertical navigation as well. Find the the ContentPlaceHolder control for your top menu, should look something like this:

<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">.

You will want to comment out everything between the beginning and closing ContentPlaceHolder tags.

<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
<!-- <SharePoint:AspMenu ID="TopNavigationMenu" .....> .... </SharePoint:AspMenu> <SharePoint:DelegateControl ...>...</SharePoint:DelegateControl> -->
</asp:ContentPlaceHolder>

Now add the new Web Part, make sure to put it between the beginning and ending ContentPlaceHolder tags:

<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server">
<spNav:spNavMenu2010 runat="server" id="TopNavigationMenu" Set_MenuList="<name of your list>" Set_ServerURL="<url of your SharePoint site>" />
<!-- <SharePoint:AspMenu ID="TopNavigationMenu" .....> .... </SharePoint:AspMenu> <SharePoint:DelegateControl ...>...</SharePoint:DelegateControl> -->
</asp:ContentPlaceHolder>

Just for clarity, you will notice that the original/commented out AspMenu is below the spNav Web Part we just added and is between the ContentPlaceHolder tags. There are a couple of parameters that are necessary for the Web Part to work, one is the name of the list you just created and the other is the URL of your primary site collection, where your list resides.... If you named your list MyList and your primary site collection url was http://myspsite then your Web Part would look like this:

<spNav:spNavMenu2010 runat="server" id="TopNavigationMenu" Set_MenuOrientation="horizontal" Set_TopNavigationMenu="yes" Set_MenuList="MyList" Set_ServerURL="http://myspsite"/>

NOTE: If this is a top menu, you will need to give it a special id - "TopNavigationMenu" or the menu items will display behind the webparts on the page. There is an additional parameter to force the id, but setting the id directly will suffice.

Once you add the menu, you should see it render from the SPD designer view, if it doesnt, try clicking on a different control in the Master Page, that will usually trigger an update. Save your work and publish/approve your master page.

After you confirmed the Web Part is working you should remove the original ASP Menu, while we have commented out the menu, it appears that SPD (and SharePoint as well) still reads/processes the control. After subsequent edits to the master page from SPD, I noticed that SPD was adding some garbage to the commented menu and causing the master page to produce errors. Problem resolved by removing the commented out ASP menu.

Register the navigation css file

Find this tag in your master page:
<SharePoint:ScriptLink language="javascript" name="core.js" OnDemand="true" runat="server"/>

Add this tag right after the tag referenced above:
<SharePoint:CssRegistration name="spNavigation/spNavigation.css" After="corev4.css" runat="server"/>

This will register the css file that is installed with the web part. You can customize the css file to meet your look and feel needs, see next section.

Change The Look And Feel

So now you want to customize the look and feel, we can do that... This is where things are much easier than the 2007 counterpart. There is a custom style sheet built right into the solution. SharePoint 2010 also makes this much easier as the rendering of the menu is much cleaner. The style sheet can be found here C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\template\LAYOUTS\1033\STYLES\spNavigation\spNavigation.css. The AspMenu has been preconfigured to look like the out of the box menu, feel free to customize for your needs.

Here are the remaining parameters that are available for the Web Part:

Parameter name Default Value
Set_MenuList spNavigationMenu
Set_ServerURL
Set_MenuOrientation Horizontal
Set_MenuName spNavMenu
Set_TopNavigationMenu yes

Donations

If you like the spNavigationMenu and find it helpful, please consider making a donation to the project. Your donation will help support the further development of the spNavigationMenu project. Please click the image below to make a donation.

Donations

Last edited Dec 1, 2010 at 2:28 AM by JLSmith, version 11

Comments

PJHarley Feb 28, 2013 at 1:37 AM 
I figured it out. I had to check-in and approve v4.master then the menu showed up in Safari and Chrome.

PJHarley Feb 28, 2013 at 1:07 AM 
I love this tool but it doesn't show up in Safari or Google Chrome, why?
Even if I delete the old menu from the v4.master I still get the OOTB menu in Safari and Chrome. The menu is there in IE.
So if someone can point me in the right direction to make spNavMenu2010 work in other browsers I'd be very happy.

shroomduck Aug 1, 2012 at 8:42 PM 
Hey dude,

I created a codeplex account just to comment on this. This is awesome and I just wanted to thank you for this great feature, it looks great, functions great and is easy to use.

amolchavan777 Jul 27, 2012 at 7:40 AM 
a quick question, will it work as sandbox solution?

seschu01 Jan 23, 2012 at 3:03 AM 
Just to let you all know how to fix this as there seems to be some confusion:

1. Add the entry as indicated for the TagPrefix.
2. DO NOT COMMENT ANYTHING OUT!
- You simply need to add the line that initiates the new menu directly above the current menu code
- Add the property VISIBLE="FALSE" to the default SharePoint Menu code
3. SAVE AND DONE.

Not only will this propogate to the _layouts pages properly but will also ensure that all of the specific application pages do not throw errors. They need the menu code to function properly (Not all of them but alot do).

Here is a snippet of mine::

<spNav:spNavMenu2010 runat="server" id="TopNavigationMenu" Set_MenuList="MenuList" Set_ServerURL="http://blahddy bladdy blah/" __WebPartId="{5673E9ED-241F-4D7D-8875-596B2C83AE20}"/>

<asp:ContentPlaceHolder id="PlaceHolderHorizontalNav" runat="server" >
<SharePoint:AspMenu
ID="TopNavigationMenuV4"
Runat="server"
EnableViewState="false"
DataSourceID="topSiteMap"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
UseSimpleRendering="true"
UseSeparateCss="false"
Orientation="Horizontal"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="1"
SkipLinkText=""
Visible="false"
CssClass="s4-tn"/>

deibeat Jun 9, 2011 at 2:52 PM 
Unfortenatelly I have a strange issue : "One o more field types are not installed propertly"

crowan1984 May 25, 2011 at 8:07 PM 
I had a similar issue as maddenjc, but was able to fix it. The information needed is on the documentation page. If you just comment out the old navigation on the master page, you will get some javascript errors like that. You have to delete the old navigation, not just comment it out.

brycec1701 Mar 8, 2011 at 6:17 PM 
I meant to say that I have the same issue as maddenjc has described.

brycec1701 Mar 8, 2011 at 6:15 PM 
I am having the same issue as JL Smith. I don't understand what xbhome is trying to tell us to do. Do you have a workaround to get the ribbon for page/list editing to work?

maddenjc Dec 2, 2010 at 9:18 PM 
I'm not sure if it is the same issue as xbhome is referencing, but I have a ribbon issue when going into the "Item" or "List" ribbons. When clicking on those links to open up the ribbons, it just says loading--but it never loads. I have the css referenced in the master page, so that's not the problem.

JLSmith Dec 1, 2010 at 2:22 AM 
What ribbon issue are you experiencing? I did neglect to share how to register the navigation menu css, perhaps that is related to the issue you are experiencing...

xbhome Oct 27, 2010 at 6:04 AM 
Need to use original menu and this menu to avoid Ribbon issue.
I used a like this in master page to working.
<table><tr><td>original menu lines... </td><td>spnavmenu2010... </td></tr></table>

xbhome Oct 27, 2010 at 5:11 AM 
I receive the error about "unsafe" until I changed the web.config from Namespace="spNavMenu2010.VisualWebPart1" to Namespace="spNavMenu2010". I don't know why, but it worked!
What are you think about?
I still have some issue that I can not use Ribbon.