Share 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)
Available in Sandboxed Solutions: No

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

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type