Compartilhar via


TemplateBasedControl.CustomAlternateTemplate Property

Gets or sets a custom alternate template.

Namespace:  Microsoft.SharePoint.WebControls
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

Syntax

'Declaration
<TemplateContainerAttribute(GetType(TemplateContainer))> _
<PersistenceModeAttribute(PersistenceMode.InnerProperty)> _
Public Property CustomAlternateTemplate As ITemplate
    Get
    Set
'Usage
Dim instance As TemplateBasedControl
Dim value As ITemplate

value = instance.CustomAlternateTemplate

instance.CustomAlternateTemplate = value
[TemplateContainerAttribute(typeof(TemplateContainer))]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
public ITemplate CustomAlternateTemplate { get; set; }

Property Value

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

Remarks

The CustomTemplate and CustomAlternateTemplate properties are marked with the [PersistenceMode(PersistenceMode.InnerProperty)] attribute. This means that the ITemplate objects that they return are compiled and persist in the TemplateBasedControl object as a nested tag. There are several advantages to using precompiled templates; for example, they can be added to a page in a visual designer such as Microsoft SharePoint Designer or Visual Studio by dragging and dropping them from the designer toolbox. But there are disadvantages also. For more information, see How to: Create a Custom Field Type, Web User Controls and Web Custom Controls, and PersistenceModeAttribute.

See Also

Reference

TemplateBasedControl Class

TemplateBasedControl Members

Microsoft.SharePoint.WebControls Namespace

Web User Controls and Web Custom Controls

Other Resources

How to: Create a Custom Field Type

Custom Field Types

Walkthrough: Creating a Custom Field Type