Export (0) Print
Expand All

TemplateBasedControl.CustomTemplate property

Gets or sets a custom template.

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

[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[TemplateContainerAttribute(typeof(TemplateBasedControl))]
public ITemplate CustomTemplate { get; set; }

Property value

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

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 Patterns of Custom Field Rendering, Web User Controls and Web Custom Controls, and PersistenceModeAttribute.

Community Additions

Show:
© 2014 Microsoft