This documentation is archived and is not being maintained.

TemplatedControlDesigner.GetTemplateContent Method

When overridden in a derived class, gets the template's content.

[Visual Basic]
Public MustOverride Function GetTemplateContent( _
   ByVal editingFrame As ITemplateEditingFrame, _
   ByVal templateName As String, _
   <Out()> ByRef allowEditing As Boolean _
) As String
[C#]
public abstract string GetTemplateContent(
 ITemplateEditingFrame editingFrame,
 string templateName,
   out bool allowEditing
);
[C++]
public: virtual String* GetTemplateContent(
 ITemplateEditingFrame* editingFrame,
 String* templateName,
   [
   Out
] bool* allowEditing
) = 0;
[JScript]
public abstract function GetTemplateContent(
   editingFrame : ITemplateEditingFrame,
 templateName : String,
 allowEditing : Boolean
) : String;

Parameters

editingFrame
The template editing frame to retrieve the content of.
templateName
The name of the template.
allowEditing
true if the template's content can be edited; false if the content is read-only.

Return Value

The content of the template.

Example

[Visual Basic] The following code example overrides the GetTemplateContent method to set the name and content of the template and allow editing of the template.

[Visual Basic] 
' Override the GetTemplateContent method to return the content
' contained in the template.
Public Overrides Function GetTemplateContent(editingFrame As ITemplateEditingFrame, templateName As String, ByRef allowEditing As Boolean) As String
   ' Ensure that the designer verb is first in the collection
   ' and that the name of the template is ItemTemplate.
   Debug.Assert((editingFrame.Verb.Index = 0))
   Debug.Assert(templateName.Equals("ItemTemplate"))
   allowEditing = True
   
   Dim template As ITemplate = CType(Component, TemplatedList).ItemTemplate
   Dim templateContent As String = [String].Empty
   
   ' If the template is already created, use the text
   ' already created for it.
   If Not (template Is Nothing) Then
      templateContent = GetTextFromTemplate(template)
   End If
   
   Return templateContent
End Function

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

TemplatedControlDesigner Class | TemplatedControlDesigner Members | System.Web.UI.Design Namespace

Show: