首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> 關於.NET

WSS 3.0 SDK 技術詳解:如何定制 Mobile 列表視圖與表單頁面——三區塊選擇器與 RenderingTemplate ID 體系完整解析

     編輯:關於.NET

Mobile 列表頁面三區塊渲染架構

Mobile 列表視圖/表單頁面(頁首/主體/頁腳)各由一個選擇器控制項發起鏈式調用:

選擇器負責區塊類別
頁首TitleSPMobileListTitle
主體ContentsSPMobileListContents
頁腳NavigationSPMobileListNavigation

RenderingTemplate 統一 ID 格式

Mobile_{ListTypeID}_{PageType}_{PageArea}
元件說明與取值來源
ListTypeID列表範本 ID(如 104)或 SPListTemplateType 列舉值(如 Announcements、Contacts)。來源同欄位渲染。
PageType頁面類型:View、NewForm、EditForm、DispForm、DeletePage。
PageArea頁面區塊:Title、Contents、Navigation。

找不到特定模板時,回退 Mobile_Default_{PageType}_{PageArea}。

內建 RenderingTemplate 部分清單

預載於 MobileDefaultTemplates.ascx:

  • Mobile_Comments_DeletePage_Navigation
  • Mobile_Comments_View_Navigation
  • Mobile_DiscussionBoard_DispForm_Contents
  • Mobile_DiscussionBoard_EditForm_Contents
  • Mobile_DiscussionBoard_EditForm_Navigation
  • Mobile_DiscussionBoard_NewForm_Navigation
  • Mobile_DocumentLibrary_View_Navigation
  • Mobile_Events_DispForm_Navigation
  • Mobile_Events_EditForm_Navigation
  • Mobile_Events_NewForm_Navigation
  • Mobile_Events_View_Contents
  • Mobile_Posts_DeletePage_Navigation
  • Mobile_WebPageLibrary_DispForm_Contents
  • Mobile_WebPageLibrary_DispForm_Navigation
同前:**勿修改 MobileDefaultTemplates.ascx**。同 ID 自訂模板會覆寫(字母序後勝出),同檔重複 ID 皆不載入。預設模板 Mobile_Default_* 亦在該檔,同樣風險。

自訂流程標準化

  1. 建立 .ascx 置於 \12\TEMPLATE\CONTROLTEMPLATES。
  2. 註冊命名空間指示詞。
  3. 宣告 <SharePoint:RenderingTemplate>,ID 依 Mobile_{ListTypeID}_{PageType}_{PageArea} 格式。
  4. <Template> 內放置控制項或巢狀 SPMobileComponent。
  5. iisreset 生效。

巢狀模板範例:擴充導航列保留預設項目

<SharePoint:RenderingTemplate RunAt="Server" ID="Mobile_104_View_Navigation">
  <Template>
    <mobile:Link RunAt="Server" Text="ASP.NET Website" NavigateUrl="https://www.asp.net" />
    <mobile:Label RunAt="Server" Text="" BreakAfter="True" />
    <SPMobile:SPMobileComponent RunAt="Server" TemplateName="Mobile_Default_View_Navigation" />
  </Template>
</SharePoint:RenderingTemplate>

此模板在公告列表視圖頁頁腳**新增 ASP.NET 連結**,並透過 SPMobileComponent 內嵌預設導航模板,達到「擴充而非取代」效果。

PageType/PageArea 組合總表

PageTypeTitleContentsNavigation
ViewMobile_{LID}_View_TitleMobile_{LID}_View_ContentsMobile_{LID}_View_Navigation
NewFormMobile_{LID}_NewForm_TitleMobile_{LID}_NewForm_ContentsMobile_{LID}_NewForm_Navigation
EditFormMobile_{LID}_EditForm_TitleMobile_{LID}_EditForm_ContentsMobile_{LID}_EditForm_Navigation
DispFormMobile_{LID}_DispForm_TitleMobile_{LID}_DispForm_ContentsMobile_{LID}_DispForm_Navigation
DeletePageMobile_{LID}_DeletePage_TitleMobile_{LID}_DeletePage_ContentsMobile_{LID}_DeletePage_Navigation

掌握此 ID 體系,即可精準定制任意列表、任意頁面、任意區塊的 Mobile 渲染行為。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved