我有以下代码将顶部全局导航中的子站点显示为多级下拉菜单:
<div id="s4-topheader2" class="s4-pr s4-notdlg">
<a name="startNavigation"></a>
<div id="s4-searcharea" class="s4-search s4-rp">
<asp:ContentPlaceHolder id="PlaceHolderSearchArea" runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" Version="4"/>
</asp:ContentPlaceHolder>
<span class="s4-help">
<span style="height: 17px; width: 17px; ; display: inline-block; overflow: hidden;" class="s4-clust">
<a href="#" style="height: 17px; width: 17px; display: inline-block;" onclick="TopHelpButtonClick('HelpHome');return false" accesskey="<%$Resources:wss,multipages_helplink_accesskey%>" id="TopHelpLink" title="<%$Resources:wss,multipages_helplinkalt_text%>" runat="server">
<img src="/_layouts/images/fgimg.png" alt="<%$Resources:wss,multipages_helplinkalt_text%>" style="left: -0px !important; top: -309px !important; ;" align="absmiddle" border="0" runat="server" /></a></span>
</span>
</div>
<div class="s4-rp s4-app"></div>
<div class="s4-lp s4-toplinks">
<asp:ContentPlaceHolder id="PlaceHolderTopNavBar" runat="server">
<h2 class="ms-hidden">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,topnav_pagetitle%>" EncodeMethod="HtmlEncode"/>
</h2>
<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="11"
SkipLinkText=""
CssClass="s4-tn"/>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource" Id="topNavigationDelegate">
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
id="topSiteMap"
runat="server"
StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
</asp:ContentPlaceHolder>
</div>
</div>
它工作正常,但子网站不按字母顺序排列。
我注意到了一些有趣的东西;不合适的网站是我移动过的网站。这些出现在最后。我尝试将所有子网站移动到一个临时新创建的网站,然后按字母顺序移回它们,但是没有用。就好像保留了最初创建它的网站的订单。
我使用的是SharePoint 2010 Standard。