Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

ContentTemplate Property

Gets or sets the template that defines the content of the UpdatePanel control.

Syntax

CSharp

[TemplateInstanceAttribute(TemplateInstance.Single)]
[PersistenceModeAttribute(PersistenceMode.InnerProperty)]
[BrowsableAttribute(false)]
public ITemplate ContentTemplate { get; set; }

VisualBasic

<TemplateInstanceAttribute(TemplateInstance.Single)> _
<PersistenceModeAttribute(PersistenceMode.InnerProperty)> _
<BrowsableAttribute(False)> _
Public Property ContentTemplate As ITemplate

ManagedCPlusPlus

[TemplateInstanceAttribute(TemplateInstance::Single)]
[PersistenceModeAttribute(PersistenceMode::InnerProperty)]
[BrowsableAttribute(false)]
public:
ITemplate^ ContentTemplate {
	ITemplate^ get ();
	void set (ITemplate^ value);
}

JSharp

/** @property */
/** @property */

Value

Return Value

An ITemplate instance that defines the content of the UpdatePanel control. The default is null.

Remarks

The ContentTemplate property contains the content that appears inside an UpdatePanel control when it is rendered. You can create the template's content declaratively or programmatically. The content template of an UpdatePanel control is a single-instance template. Therefore, the properties of the controls it contains can be accessed directly on the page without using the FindControl(String) method. For more information, see the TemplateInstanceAttribute class overview.

To add items to the UpdatePanel control declaratively, add an <ContentTemplate> element between the opening and closing tags of the UpdatePanel control. Inside the <ContentTemplate> element tags, declare other controls and HTML elements.

To add items to the UpdatePanel control dynamically, use the ContentTemplateContainer property, which enables you to add child controls without having to create a custom template that implements the ITemplate interface.

Exceptions

ExceptionCondition
InvalidOperationException

The ContentTemplate property of the UpdatePanel control is set after an instance of the template is created or after the content template container is created.

Assembly: System.Web.Extensions (Module: System.Web.Extensions)