Walkthrough: Customizing Item Titles on a Mobile Display Form
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.
This walkthrough shows how to customize the rendering of fields on mobile pages by implementing a custom RenderingTemplate. The example shows how to customize, on the mobile Display page, the Title field of an item in an Announcements list. For an overview of the steps in customizing fields on mobile pages, see How to: Customize Field Rendering on Mobile Pages.
As described in Mobile Page Rendering System, an Microsoft.SharePoint.MobileControls.SPMobileListFieldSelector template selector control is called, through a chain of calls, from a control on the page.
This object determines, based on the current list type and field (which are Announcements and Title, respectively, in this example), which RenderingTemplate renders the field on the mobile Display page.
The control looks for a RenderingTemplate named MobileCustomListField_ListTypeID_FieldType_Field.
ListTypeID is either the ID number of the type of the current list (such as 105) or one of the values of the SPListTemplateType enumeration (such as Contacts). FieldType is the data type of the field, for example, Text or Number, and Field is the name of the field, such as WorkPhone. If no RenderingTemplate with that ID exists, then the RenderingTemplate with the ID MobileDefaultListField is used.
When Windows SharePoint Services 3.0 ships, there is no RenderingTemplate with the ID MobileCustomListField_Announcements_Text_Title. In this walkthrough you will create one that substitutes, on the mobile Display page for an item in the Announcements list, a new Title for the item.
To customize the Title field of an Announcements item:
In any text editor, create a text file (UTF-8) with the name AnnouncementsItemDisplayPageTitleField.ascx in the folder Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES.
Add the following directives to the file:
<%@ Control Language="C#" %> <%@ Assembly Name="Microsoft.SharePoint, Version=22.214.171.124, 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=126.96.36.199, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=188.8.131.52, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<SharePoint:RenderingTemplate RunAt="Server" ID="MobileCustomListField_Announcements_Text_Title" > </SharePoint:RenderingTemplate>
<Template> <mobile:Label Text="Title field in Announcements List" RunAt="Server" /> </Template>
Save and close the file.
Reset Microsoft Internet Information Services (IIS) by entering iisreset on a command line.
If you are using a device emulator on a computer, rather than an actual mobile device, you may need to delete temporary internet files.
Navigate to the Announcements list with your device or emulator. Click an item to display it. You should see the new Title as shown in the following screenshot: