Condividi tramite


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

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

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type