This walkthrough will show you how to customize the mobile list view page by implementing a custom RenderingTemplate control. The following example shows how to customize the content of a page.
As described in the previous section on mobile page rendering mechanism, a Microsoft. sharePoint. mobileControls. the SPMobileListContents template selector control is called, and the control displayed on the page is finally found through a chain call.
Based on the current list type, this object determines whatRenderingTemplateThe widget is rendered in the content section of the mobile homepage. Search for this controlRenderingTemplateObject NameMobile _ListTypeID_ View_Contents, WhereListTypeIDIt can be the ID number defined by a list orSPListTemplateTypeEnumeration value. If this ID does not existMobile_Default_View_ContentsOfRenderingTemplateObject.
Windows SharePoint Services 3.0 does not have the built-in IDMobile_Announcements_View_Contents(OrMobile_pai_view_contents, Which refers to the same list type)RenderingTemplateClass Object. In this drill, you will create one to add a greeting message to the notification list.
Procedure
In the text editor, create a text file (UTF-8) namedAnnouncementsViewPageContents.ascx
. Stored in Local_Drive: \ Program Files \ Common Files \ Microsoft Shared \ web server extensions \ 12 \ TEMPLATE \ CONTROLTEMPLATESDirectory.
Add the following points to the tag to the file:
<%@ Control Language="C#" %> <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="mobile" Namespace="System.Web.UI.MobileControls" Assembly="System.Web.Mobile, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" %> <%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
3. Then, addRenderingTemplateObject, set its IDView
TheSPMobileWebTitleObject ID:Mobile_pai_view_contents.
<SharePoint:RenderingTemplate ID="Mobile_104_View_Contents" RunAt="Server" ></SharePoint:RenderingTemplate>
4. InRenderingTemplateDefineTemplateElement to containLabelChild widget. Set the label attributes as follows:
<Template> <SPMobile:SPMobileControlContainer RunAt="Server"> <SPMobile:SPMobileComponent RunAt="Server" TemplateName="MobileViewPicker" /> <SPMobile:SPMobileComponent RunAt="Server" TemplateName="MobileDefaultSeparator" /> </SPMobile:SPMobileControlContainer> <mobile:Label RunAt="Server" Text="Hello SharePoint Mobile User!"/> <SPMobile:SPMobileListItemIterator RunAt="Server" ListItemSeparatorTemplateName="MobileListItemSeparator" /> </Template>
Save and close the file.
ReSTART Internet Information Services (IIS ). You can use the iisreset command in the command line to restart IIS.
If you are using a device simulator on your computer, rather than a real mobile device, you may also need to delete Temporary Internet Files.
Navigate to a notification list from your device or simulator. You will see the greeting information at the top of the list, as shown on the screen below:
Reproduced http://www.cnblogs.com/Sunmoonfire/archive/2008/07/21/1247898.html