How to: Customize Mobile List View and Form Pages

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 topic provides an overview of the basic procedure for customizing Windows SharePoint Services 3.0 list view and form pages that are accessible to mobile devices. For a detailed procedure, see Walkthrough: Customizing a Mobile List View Page. For an overview of how to customize mobile home pages, see How to: Customize Mobile Home Pages.

As described in detail in Mobile Page Rendering System, controls in the Header (Title), Contents, and Footer (Navigation) areas of a mobile home page each start a chain of calls that results in calls to, respectively, the following three template selector controls.

An object of one of these classes selects a RenderingTemplate object based on the current list type (for example, Announcements or some custom type of list) and the type of page.

These controls look for a RenderingTemplate ID that has the following format:

Mobile_ListTypeID_PageType_PageArea

where ListTypeID is either the ID number of the current list type (such as 105) or one of the values of the SPListTemplateType enumeration (such as Contacts). There are two ways that a list type ID can be defined:

  • If the list is specified as part of the site type in the Onet.xml file of the site definition, then ListTypeID is the value the Type attribute of the List element in Onet.xml. This file is located in the following directory: Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SITETEMPLATES\Site_Type\xml. (For a list of the ID numbers of all list types that ship with Windows SharePoint Services 3.0, see Mobile Page Rendering System.)

  • If the list was added to the site in the UI; that is, the New (list) page, then ListTypeID is the ID of the list type that was used as the basis of the new list type. This is determined by what link the user clicked on the Create page (create.aspx) in order to get to the New page.

PageType is View, NewForm, EditForm, DispForm, or DeletePage.

PageArea is Title, Contents, or Navigation. (For more information about the sections of a mobile page, see Layout and Pagination of Mobile Pages.)

If a RenderingTemplate element with an ID that specifies the current list type does not exist, then a RenderingTemplate element with an ID on the pattern Mobile_Default_PageType_PageArea is used.

To create a custom Header (Title), Content, or Footer (Navigation) area on a mobile list view or form page you only need to create a RenderingTemplate element with the ID that the page area's template selector control is looking for. (See the procedure below for additional details.)

Existing RenderingTemplates

The following list identifies RenderingTemplate elements for mobile list view and form pages that are included in the MobileDefaultTemplates.ascx file that is installed with Windows SharePoint Services.

  • Mobile_Comments_DeletePage_Navigation

  • Mobile_Comments_View_Navigation

  • Mobile_DiscussionBoard_DispForm_Contents

  • Mobile_DiscussionBoard_EditForm_Contents

  • Mobile_DiscussionBoard_EditForm_Navigation

  • Mobile_DiscussionBoard_NewForm_Navigation

  • Mobile_DocumentLibrary_View_Navigation

  • Mobile_Events_DispForm_Navigation

  • Mobile_Events_EditForm_Navigation

  • Mobile_Events_NewForm_Navigation

  • Mobile_Events_View_Contents

  • Mobile_Posts_DeletePage_Navigation

  • Mobile_WebPageLibrary_DispForm_Contents

  • Mobile_WebPageLibrary_DispForm_Navigation

You may not modify the MobileDefaultTemplates.ascx file. You can create a new RenderingTemplate element (in your own .ascx file) with the same name as one of the existing elements, but if you do there is a risk that you will break other solutions deployed in Windows SharePoint Services that depend on the original RenderingTemplate element that has the same name.

Note

The RenderingTemplate elements that ship with Windows SharePoint Services 3.0 load before custom templates load, so when a custom template with the same name as one of the existing rendering templates loads, the custom template overrides the original template. If more than one custom RenderingTemplate object has the same name, the one whose file name is alphabetically last will override all the others. If a specific file has two or more rendering templates with the same name, none of them is loaded.

In addition, the following default RenderingTemplate elements are defined in the same file. These are used by the runtime whenever a RenderingTemplate for the current list type is not defined. The same risk is present if you create new RenderingTemplate object with any of these names:

  • Mobile_Default_DeletePage_Contents

  • Mobile_Default_DeletePage_Navigation

  • Mobile_Default_DeletePage_Title

  • Mobile_Default_DispForm_Contents

  • Mobile_Default_DispForm_Navigation

  • Mobile_Default_DispForm_Title

  • Mobile_Default_EditForm_Contents

  • Mobile_Default_EditForm_Navigation

  • Mobile_Default_EditForm_Title

  • Mobile_Default_NewForm_Contents

  • Mobile_Default_NewForm_Navigation

  • Mobile_Default_NewForm_Title

  • Mobile_Default_View_Contents

  • Mobile_Default_View_Navigation

  • Mobile_Default_View_Title

You can nest RenderingTemplate objects. See the example below.

To customize a section of a mobile list view or form page

  1. In Microsoft Visual Studio, Notepad, or a text editing application, create a user control file (.ascx) in the the path \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES.

  2. To register or import the appropriate namespaces, add the necessary page directives to the .ascx file.

  3. Add a rendering template to the .ascx file and give it an ID in the following format: Mobile_ListTypeID_PageType_PageArea.

    • ListTypeID either the ID number of a type of the current list (such as 105) or one of the values of the SPListTemplateType enumeration (such as Contacts).

    • PageType can be View, NewForm, EditForm, DispForm, or DeletePage.

    • PageArea can be Title, Contents, or Navigation.

  4. Save the .ascx file and reset Internet Information Services (IIS) to effect your changes.

Example

The following example of a RenderingTemplate definition shows how you can nest RenderingTemplate objects. For example of how to customize a list view page, see Walkthrough: Customizing a Mobile List View Page.

<SharePoint:RenderingTemplate RunAt="Server" ID="Mobile_104_View_Navigation">
  <Template>
    <mobile:Link RunAt="Server" Text="ASP.NET Website" href="http://www.asp.net" />
    <mobile:Label RunAt="Server" Text="" BreakAfter="True" />
    <SPMobile:SPMobileComponent RunAt="Server" TemplateName="Mobile_Default_View_Navigation" />
  </Template>
</SharePoint:RenderingTemplate>

See Also

Tasks

Walkthrough: Customizing a Mobile List View Page

How to: Customize Mobile Home Pages

Concepts

Layout and Pagination of Mobile Pages

How to: Customize the Mobile Home Page through Redirection

Mobile Page Rendering System