This walkthrough will show you how to customize the rendering of fields on the mobile page by implementing a custom renderingtemplate control. The example shows how to customize the display of the title field of the notification list item on the Mobile Display page.
As described in the previous section on mobile page rendering mechanism,Microsoft. Sharepoint. mobilecontrols. spmobilelistfieldselectorThe template selector control is called, and a chain is called to find the control displayed on the page.
Based on the current list type and field (such as the notification and title in this example), this object determines whichRenderingtemplateThis field is used to render the field on the Mobile Display page.
Search for this controlRenderingtemplateObject NameMobilecustomlistfield _Listtypeid_Fieldtype_Field, WhereListtypeidIt can be the ID of the current list type (such as 105), or a value of the splisttemplatetype enumeration (such as contacts ).FieldtypeIs the Data Type of the field. For example, text or number.FieldIs the internal name of the field, such as workphone. If this ID does not existMobiledefalistlistfieldOfRenderingtemplateObject.
WSS 3.0 does not have the built-in IDMobilecustomlistfield_announcements_text_titleOfRenderingtemplate. In this drill, you will create a new template for the list item title field of the notification list to replace the default template.
Custom notification item title:
-
In the text editor, create a text file (UTF-8) named announcementsitemdisplaypagetitlefield. 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 ID to displaySpmobilewebtitleObject ID:Mobilecustomlistfield_announcements_text_title.
< SharePoint: renderingtemplate Runat = "Server" ID = "Mobilecustomlistfield_announcements_text_title" >
</ SharePoint: renderingtemplate >
InRenderingtemplateDefineTemplateElement to containLabelChild widget. Set the label attributes as follows:
< Template >
< Mobile: Label Text = "Title field in announcements list" Runat = "Server" />
</ 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. Click a notification to go to its display page. You will see the newly customized title, as shown on the screen below: