Partager via


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

'Declaration
<TemplateContainerAttribute(GetType(TemplateContainer))> _
Public Property AlternateTemplate As ITemplate
    Get
    Set
'Usage
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 property returns the template named by the AlternateTemplateName property. (If the latter property is not specifically set, it returns the value of the DefaultAlternateTemplateName property.)

Notes to callers

The 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.

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