WSS3SDK之:配置導航使用自訂資料來源

來源:互聯網
上載者:User
通過使用Microsoft.SharePoint.WebControls.DelegateControl,我們可以為快速啟動導航指定一個自訂的
資料來源控制項。通過傳遞給該委拖(delegate)的控制項來為快速啟動提供資料來源。資料可以來自資料庫或代碼中。這種類型的定製化並不會改變連結的顯示方
式。

您可以通過替換又委託功能提供的資料來源來替換快速啟動中預設顯示的節點。

下面的樣本顯示了default.master中聲明的預設資料來源,其中指定ControlId的值為QuickLaunchDataSource。<SharePoint:DelegateControl runat="server"
ControlId="QuickLaunchDataSource"
Scope="Web">
<asp:SiteMapDataSource
SiteMapProvider="SPQuickLaunchProvider"
ShowStartingNode="False"
id="QuickLaunchSiteMap"
runat="server"
/>
</SharePoint:DelegateControl>

我們可以建立一個功能(feature)來覆蓋預設的委託。在\TEMPLATE\FEATURES目錄下建立一個檔案夾來指定替代資料來源。
首先建立Feature.xml檔案來引用feature所需的元素,包括資料來源使用的dll組件和其他XML檔案(NavigationSiteSettings.xml)。<Feature Id="541F5F57-C847-4e16-B59A-B31E90E6F9EA"
 Title="Portal Left Navigation"
 Description="Enable portal navigation for the left navigation bar."
 Version="12.0.0.0"
 Scope="Web"
 ReceiverAssembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
 ReceiverClass="Microsoft.SharePoint.Publishing.NavigationFeatureHandler"
 xmlns="http://schemas.microsoft.com/sharepoint/">
 <ElementManifests>
 <ElementManifest Location="NavigationSiteSettings.xml"/>
 </ElementManifests>
</Feature>

下面是NavigationSiteSettings.xml,該檔案重定義了site map provider作為QuickLaunchDataSource控制項,將Sequence屬性值設為50,來替換預設的左側導航結點。
(註:Sequence值要比原先傳遞給委託的控制項的值低,才能替換原先的控制項)
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
 <Control Id="QuickLaunchDataSource" Sequence="50"
 ControlClass="System.Web.UI.WebControls.SiteMapDataSource"
 ControlAssembly="System.Web, version=2.0.3600.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
 <Property Name="SiteMapProvider">AreasAndPagesSiteMapProvider</Property>
 <Property Name="EnableViewState">true</Property>
 <Property Name="StartFromCurrentNode">true</Property>
 <Property Name="StartingNodeOffset">0</Property>
 <Property Name="ShowStartingNode">false</Property>
 <Property Name="ID">qlSiteMap</Property>
 </Control>
 <HideCustomAction
 Id="QuickLaunch"
 HideActionId="QuickLaunch"
 GroupId="Customization"
 Location="Microsoft.SharePoint.SiteSettings" />

</Elements>


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.