This documentation is archived and is not being maintained.

TemplatedControlDesigner.GetTextFromTemplate Method

Gets a string of text that represents the specified template.

[Visual Basic]
Protected Function GetTextFromTemplate( _
   ByVal template As ITemplate _
) As String
[C#]
protected string GetTextFromTemplate(
 ITemplate template
);
[C++]
protected: String* GetTextFromTemplate(
 ITemplate* template
);
[JScript]
protected function GetTextFromTemplate(
   template : ITemplate
) : String;

Parameters

template
The ITemplate to convert to text.

Return Value

A string that represents the specified template.

Example

[Visual Basic] The following code example overrides the GetTemplateContent method to call the GetTextFromTemplate method. The GetTextFromTemplate method call obtains the text representation of a previously created template for the designer.

[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: