Partilhar via


SPMobilePageContents.DefaultTemplateName Property

Gets the value of the ID attribute of the <RenderingTemplate> element that defines the rendering of the contents when the control is 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 DefaultTemplateName As String
    Get
'Usage
Dim instance As SPMobilePageContents
Dim value As String

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

Property Value

Type: System.String
A String that represents the ID of the template for the home page.

Remarks

In SharePoint Foundation this property always returns "MobileHomePageContents". This 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 the home page contents, 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 "MobileHomePageContentsMyCompanyInc". Then derive a new class from SPMobileComponent, (the same parent as SPMobilePageContents) and override its DefaultTemplateName property so that it returns your custom ID. Add an object of the new class to the <SPMobileForm> element of a mobile Web page.

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

See Also

Reference

SPMobilePageContents Class

SPMobilePageContents Members

Microsoft.SharePoint.MobileControls Namespace