Friday, May 11, 2012

Special Characters in SharePoint Top Navigation

When I was creating a custom master page for a SharePoint 2010 site, I ran run into an issue with the top navigation bar since some headings and links had special characters.  When I view the page “Plans & Pricing” was rendered as " Plans & Pricing". That means ampersand shows as & in the global navigation. Also “FAQ’s” was rending as “FAQ's”.







The solution was to just add EncodeTitle="false" in the AspMenu control.
<!-- ------------| TOP NAVIGATION  |------------ -->
<div class="s4-notdlg">
 <!-- top navigation publishing data source -->
 <SharePoint:AspMenu
   ID="TopNavigationMenuV4"
   Runat="server"
   EnableViewState="false"
   DataSourceID="topSiteMap"
   AccessKey="<%$Resources:wss,navigation_accesskey%>"
   UseSimpleRendering="true"
   UseSeparateCss="false"
   Orientation="Horizontal"
   StaticDisplayLevels="1"
   MaximumDynamicDisplayLevels="1"
   SkipLinkText=""
   EncodeTitle="false"
   CssClass="s4-tn"/>
                       
 <asp:SiteMapDataSource
   ShowStartingNode="False"
   SiteMapProvider="CombinedNavSiteMapProvider"
   id="topSiteMap"
   runat="server"/>
</div>
<!-- ------------| TOP NAVIGATION  |------------ -->


No comments: