Compartilhar via


TemplateBasedControl.ControlTemplate property

Gets the template that renders the control in the current context.

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

Syntax

'Declaration
Protected Overridable ReadOnly Property ControlTemplate As ITemplate
    Get
'Usage
Dim value As ITemplate

value = Me.ControlTemplate
protected virtual ITemplate ControlTemplate { get; }

Property value

Type: System.Web.UI.ITemplate
A ITemplate object that renders the control.

Remarks

When this property is overridden in a derived class, the get accessor has logic that decides which one of the ITemplate type properties of the TemplateBasedControl object is actually used in the current context to render the field.

Notes to inheritors

The default implementation of the get accessor returns the value of the Template property in all contexts. If you need an AlternateTemplate property to render the control in certain contexts, such as a particular form, override the get accessor to include your selection logic.

See also

Reference

TemplateBasedControl class

TemplateBasedControl members

Microsoft.SharePoint.WebControls namespace

Other resources

Patterns of Custom Field Rendering

Custom Field Types

Walkthrough: Creating a Custom Field Type