Condividi tramite


Mobile Page Rendering System

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 describes how Windows SharePoint Services 3.0 uses RenderingTemplates and template selector controls to render pages that are accessible from mobile devices.

The Controls on the Page

Mobile pages are rendered with RenderingTemplate controls, but these are not referenced directly on the page. Instead, each of the three major sections of the page — Header, Content, and Footer — declares a control that uses the current site definition and current page type to choose a RenderingTemplate that is declared in an .ascx file (located in \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES). The RenderingTemplates that ship with Windows SharePoint Services are declared in MobileDefaultTemplates.ascx. Custom RenderingTemplates are declared in custom .ascx files in the same folder.

The three types of controls that choose RenderingTemplates on mobile pages are:

The SPMobilePageTitle object, for example, is declared in the HeaderTemplate section of the STS home page, mbllists.aspx, as shown here:

<HeaderTemplate>
  <SPMobile:SPMobileControlContainer RunAt="Server" Weightless="true">
    <SPMobile:SPMobilePageTitle RunAt="Server" />
    <SPMobile:SPMobileComponent TemplateName="MobileDefaultSeparator" RunAt="Server" />
  </SPMobile:SPMobileControlContainer>
</HeaderTemplate>

An object of one of these classes selects a RenderingTemplate based on the type of the current page being requested (such as home page, list view page, or edit form). For example, on a home page, SPMobilePageTitle will call a RenderingTemplate with the ID "MobileHomePageTitle" and on a New item form, SPMobilePageContents will call a RenderingTemplate with the ID "MobileNewFormContents".

Inside the .ASCX File

The RenderingTemplates called by the controls on the page have a Template element whose value is an object of a class that derives from SPMobileTemplateSelector. There are nine of these classes:

As is suggested by the name of the class from which they drive, these controls select another RenderingTemplate to actually render a part of the page. For example, the "MobileHomePageTitle" RenderingTemplate mentioned in The Controls on the Page section has SPMobileWebTitle as the value of its Template element. SPMobileWebTitle calls a RenderingTemplate that will render the Header (Title) area of a mobile home page.

Rendering of Sections on a Mobile Home Page

As noted, "MobileHomePageTitle" has SPMobileWebTitle as the value of its Template element. SPMobileWebTitle calls a RenderingTemplate that will render the Header (Title) area of a mobile home page. Specifically, it will look for a RenderingTemplate with an ID of Mobile_SiteTypeID_HomePage_Title, where SiteTypeID is the name or ID number of the site definition of the current Web site. For the site definitions that ship with Windows SharePoint Services 3.0, SiteTypeID can be either STS or BLOG.

Note

Access from mobile devices is not supported for MPS, CENTRALADMIN, and WIKI sites.

For custom site definitions, SiteTypeID is the ID number (not the name) of the site definition. (The ID of a site definition is set with the ID attribute of a Template element in a WebTemp.xml file. For more about the ID attribute of a site definition, see WebTemp.xml.)

If a RenderingTemplate for the specific current site definition does not exist in any .ascx file in \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES, the rendering system will use Mobile_Default_HomePage_Title (which, in turn, calls a control, SPMobileWeb, that simply renders the Web site title with a Label control). For more information about working with the home page RenderingTemplates that ship with Windows SharePoint Services, see How to: Customize Mobile Home Pages.

SPMobileWebContents and SPMobileWebNavigation select a RenderingTemplate that will render, respectively, the main page Content area and the Footer (Navigation) area of a mobile home page. So all of the first three selector classes look for RenderingTemplates with IDs on the pattern Mobile_SiteTypeID_HomePage_PageArea, where PageArea is Title, Contents, or Navigation.

Rendering of Sections on List View and Form Pages

The SPMobileListTitle, SPMobileListContents, and SPMobileListNavigation classes are used on list view and form pages. They each look for RenderingTemplates with IDs on the pattern Mobile_ListTypeID_PageType_PageArea, where PageType is View, NewForm, EditForm, DispForm, or DeletePage, and 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). If the list is specified to be 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, which is located in the following directory: Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SITETEMPLATES\Site_Type\xml. If the list was added to the site in 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.

The following table shows the ID numbers of the list types that ship with Windows SharePoint Services 3.0. You can also use the ID number of custom list types. The latter should be numbers above 10000 to ensure that they do not conflict with numbers that will be used by Microsoft in future versions of Windows SharePoint Services.

ID

Description

100

Generic list

101

Document library

102

Survey

103

Links list

104

Announcements list

105

Contacts list

106

Events list

107

Tasks list

108

Discussion board

109

Picture library

110

Data sources

111

Site template gallery

112

UserInformation

113

Web Part gallery

114

List template gallery

115

XML Form library

116

MasterPageCatalog

117

NoCodeWorkflows

118

WorkflowProcess

119

WebPageLibrary

120

Custom grid for a list

130

DataConnectionLibrary

140

WorkflowHistory

150

GanttTasks

200

Meeting Series list

201

Meeting Agenda list

202

Meeting Attendees list

204

Meeting Decisions list

207

Meeting Objectives list

210

Meeting text box

211

Meeting Things To Bring list

212

Meeting Workspace Pages list

300

Portal Sites list.

301

Posts

302

Comments

303

Categories

1100

Issue tracking

1200

AdminTasks

2002

Personal document library

2003

Private document library

If a RenderingTemplate with an ID that specifies the current list type does not exist, then a RenderingTemplate with an ID on the pattern Mobile_Default_PageType_PageArea is used. For more information about working with the list rendering RenderingTemplates that ship with Windows SharePoint Services, see How to: Customize Mobile List View and Form Pages.

Field Rendering

SPMobileListFieldSelector selects RenderingTemplates that render particular fields on list view, New, Edit, or Display pages. It looks for a RenderingTemplate with an ID that uses the following pattern MobileCustomListField_ ListTypeID _FieldType_Field.

ListTypeID is the same as described in the preceding section. FieldType is the data type of the field. It can be any of the values of the SPFieldType enumeration; for example, Text or Number. It can also be a custom field type as defined by the <Field Name="TypeName"> element in the fldtypes*.xml file that defines the custom field type. (For more information about custom field types, see Custom Field Type Definition.)

Field is the internal name of the field, such as WorkPhone. If the field is specified to be part of the list in the Schema.xml file for the list definition, then the internal name can be found as the value the Name attribute of the Field element schema.xml, which is located in the following directory: Local_Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\Feature_Folder. If the field was added to the list in the UI; that is, the Create Column page, then Field is the value of the SPField.InternalName property and can be found only through the object model.

Note

Field is the internal name of the field (column), which is not necessarily the same as the display name of the field. For fields created by users in the UI, the internal name is generated by the system from the display name chosen by the user (in the Column name box of the Create Column page). If the user included spaces or punctuation marks in the display name, the mobile template rendering system will not be able to work with the internal name that is generated, so you will not be able to customize the rendering of such fields.

If there is no RenderingTemplate with the ID that is being sought exists, then the RenderingTemplate with the ID MobileDefaultListField is used. For more information about working with the field rendering RenderingTemplates that ship with Windows SharePoint Services, see How to: Customize Field Rendering on Mobile Pages.

How Field Rendering for Mobile Devices Differs from Field Rendering for Computers

In Windows SharePoint Services 3.0, field rendering with custom field rendering controls for mobile devices is similar to field rendering with custom field rendering controls for computers. But keep these differences in mind:

Title of List of Posts on Mobile Blog Sites

SPMobilePostsListTitle chooses either Moblog_MyPosts_Title or Moblog_AllPosts_Title to render the title of a list of posts on a mobile blog site, based on whether the current view type of the blog site is MyPosts or AllPosts.

Nesting RenderingTemplates

RenderingTemplates can be nested. See the example in How to: Customize Mobile Home Pages.

See Also

Tasks

Walkthrough: Customizing a Mobile Home Page

How to: Customize Mobile List View and Form Pages

Walkthrough: Customizing a Mobile List View Page

How to: Customize Mobile Home Pages

Walkthrough: Customizing Item Titles on a Mobile Display Form

How to: Customize Field Rendering on Mobile Pages

Concepts

Layout and Pagination of Mobile Pages

Ellipses and Rendering Limits

Custom Field Type Definition

Schema.xml

Onet.xml