Compartir a través de


TemplateBasedControl.AlternateTemplate Property

Gets or sets the template that renders the control in contexts, such as a particular form, in which rendering the control with the Template property would be inappropriate.

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

Syntax

<TemplateContainerAttribute(GetType(TemplateContainer))> _
Public Property AlternateTemplate As ITemplate
    Get
    Set

Dim instance As TemplateBasedControl
Dim value As ITemplate

value = instance.AlternateTemplate

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

Property Value

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

Remarks

If the AlternateTemplate property is not set, the default implementation returns the template named by the AlternateTemplateName property. (If the latter property is not specifically set, its default implementation returns the value of the DefaultAlternateTemplateName property.)

Notes to Callers

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

Notes to Inheritors

Override the get accessor of the ControlTemplate property to implement your logic for selecting either the Template or 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