다음을 통해 공유


SPMobileComponent.TemplateName Property

Gets or sets the ID attribute of a <RenderingTemplate> element that controls the rendering of the SPMobileComponent object.

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

Syntax

'Declaration
Public Overridable Property TemplateName As String
    Get
    Set
'Usage
Dim instance As SPMobileComponent
Dim value As String

value = instance.TemplateName

instance.TemplateName = value
public virtual string TemplateName { get; set; }

Property Value

Type: System.String
A String that represents the ID of a RenderingTemplate object. The default is the same value as DefaultTemplateName (which is null if not overridden). Hence, if your SPMobileComponent-derived component must have a RenderingTemplate, you must either override DefaultTemplateName, or TemplateName, or ensure that your code always sets TemplateName.

Remarks

In the default implementation, the TemplateName property holds the value of the ID attribute of a <RenderingTemplate> element in either the file MobileDefaultTemplates.ascx or GbwMobileDefaultTemplates.ascx located in %ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\CONTROLTEMPLATES or in a custom .ascx file in that same folder.

Also, in the default implementation, if Template is not explicitly set, but TemplateName is not a null reference (Nothing in Visual Basic), Template returns the RenderingTemplate template named by TemplateName.

Setting TemplateName (with its default implementation) has the side effect of setting Template to return the RenderingTemplate template that is named by TemplateName.

On the other hand, setting Template directly does not set TemplateName to the name of the RenderingTemplate template that was assigned to Template. Thus, you can reduce the danger of inconsistent values by using TemplateName when you need to set RenderingTemplate.

If the values of Template and TemplateName are inconsistent, Template determines the RenderingTemplate template that is used to render the component.

See Also

Reference

SPMobileComponent Class

SPMobileComponent Members

Microsoft.SharePoint.MobileControls Namespace