Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Walkthrough: Customizing Item Titles on a Mobile Display Form

Windows SharePoint Services 3

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:

  1. 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.

  2. Add the following directives to the file:

    <%@ Control Language="C#" %>
    <%@ Assembly Name="Microsoft.SharePoint, Version=, 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=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> 
    <%@ Register TagPrefix="SPMobile" Namespace="Microsoft.SharePoint.MobileControls" Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%@ Import Namespace="Microsoft.SharePoint" %>
  3. Below the directives, add a RenderingTemplate and give it the ID that the SPMobileListContents object on the Display form is looking for: MobileCustomListField_Announcements_Text_Title.

    <SharePoint:RenderingTemplate RunAt="Server" ID="MobileCustomListField_Announcements_Text_Title" >
  4. Inside the RenderingTemplate element, define a Template element that has a Label child control. Set the label's Text attribute as shown:

        <mobile:Label Text="Title field in Announcements List" RunAt="Server" />
  5. Save and close the file.

  6. Reset Microsoft Internet Information Services (IIS) by entering iisreset on a command line.

  7. If you are using a device emulator on a computer, rather than an actual mobile device, you may need to delete temporary internet files.

  8. 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:

Customized Mobile Display Item Form
© 2015 Microsoft