Partilhar via


SPMobilePageContents.TemplateName Property

Gets the value of the ID attribute of the <RenderingTemplate> element that defines the rendering of the page's main content area when the control in not on the home page on a mobile Web site.

Namespace:  Microsoft.SharePoint.MobileControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Overrides ReadOnly Property TemplateName As String
    Get
'Usage
Dim instance As SPMobilePageContents
Dim value As String

value = instance.TemplateName
public override string TemplateName { get; }

Property Value

Type: System.String
A String that represents the ID of the template for the page's main content area.

Remarks

The following table shows the value of this property for some selected page types of a mobile Web site. This is not a complete list of mobile page types. For more examples of templates that render content areas of pages, see the files MobileDefaultTemplates.ascx and GbwMobileDefaultTemplates.ascx in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\ControlTemplates.

Page Type

Rendering Template

List View

"MobileViewContents"

List View in a subfolder

"MobileViewContents"

New Item Form

"MobileNewFormContents"

Edit Form

"MobileEditFormContents"

Delete Item Form

"MobileDeletePageContents"

Display Item Form

"MobileDispFormContents"

Each of these strings is the value of the ID attribute of a <RenderingTemplate> element in the file MobileDefaultTemplates.ascx or GbwMobileDefaultTemplates.ascx located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\CONTROLTEMPLATES.

You must not modify MobileDefaultTemplates.ascx or GbwMobileDefaultTemplates.ascx. To customize the rendering of a page's main content area for a particular page type (such as the List View type), create another <RenderingTemplate> element in a new .ascx file in the ...\CONTROLTEMPLATES folder. Give your new <RenderingTemplate> element an ID value that is descriptive but likely to be unique. For example, you could add your company name to the end of the ID, such as "MobileViewContentsMyCompanyInc". Then derive a new class from SPMobileComponent, (the same parent as SPMobilePageContents) and override its TemplateName property so that it returns your custom ID when the page's PageType value is PAGE_VIEW. Add an object of the new class to the <SPMobileForm> element of a mobile Web page.

Contrast the TemplateName property with the DefaultTemplateName property which specifies the <RenderingTemplate> when the page is the home page of the mobile Web site.

See Also

Reference

SPMobilePageContents Class

SPMobilePageContents Members

Microsoft.SharePoint.MobileControls Namespace