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, Microsoft. Sharepoint. mobilecontrols. spmobilelistcontents The template selector control is called, and a chain is called to find the control displayed on the page.
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" % >
Then, addRenderingtemplateObject, set its IDView
TheSpmobilewebtitleObject ID:Mobile_pai_view_contents.
< SharePoint: renderingtemplate ID = "Mobile_104_view_contents" Runat = "Server" > </SharePoint: renderingtemplate>
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 = "Cancelistitemseparator" />
</ 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: