Compartir a través de


TemplateBasedControl.Template Property

Gets or sets the template that renders the control.

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

Syntax

<TemplateContainerAttribute(GetType(TemplateBasedControl))> _
Public Property Template As ITemplate
    Get
    Set

Dim instance As TemplateBasedControl
Dim value As ITemplate

value = instance.Template

instance.Template = value
[TemplateContainerAttribute(typeof(TemplateBasedControl))]
public ITemplate Template { get; set; }

Property Value

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

Remarks

If the Template property is not set, the default implementation returns the template that is named by the TemplateName property. (If the latter is not specifically set, its default implementation returns the value specified in the DefaultTemplateName property.)

Notes to Callers

The default set accessor for the Template property does not set the TemplateName property. For this reason, the two property values could be logically inconsistent. Consider leaving the Template property value unset and instead, set TemplateName. In this way, you are indirectly setting the value of the Template.

Notes to Inheritors

If you need an alternative template for rendering in certain contexts, such as a particular type of form, use the AlternateTemplate property to identify the alternate template. Override the get accessor of the ControlTemplate property to implement your logic for selecting either the Template or the AlternateTemplate.

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