This documentation is archived and is not being maintained.

TemplatedControlDesigner.GetTemplateFromText Method

Creates a template from the specified text.

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

Parameters

text
The text to retrieve a template from.

Return Value

An ITemplate from the specified text.

Example

[Visual Basic] The following code example overrides the SetTemplateContent method. When this method is called, the GetTemplateFromText method sets a template equal to the template associated with the templateContent parameter passed to the SetTemplateContent method.

[Visual Basic] 
' Override the SetTemplateContent method to check whether the template
' exists. If it does, set its content to the value already created for it.
' 
Public Overrides Sub SetTemplateContent( _
  editingFrame As ITemplateEditingFrame, _
  templateName As String, _
  templateContent As String)
   Debug.Assert((editingFrame.Verb.Index = 0))
   Debug.Assert(templateName.Equals("ItemTemplate"))
   
   Dim template As ITemplate = Nothing
   
   If Not (templateContent Is Nothing) And templateContent.Length <> 0 Then
      template = GetTemplateFromText(templateContent)
   End If
   
   CType(Component, TemplatedList).ItemTemplate = template
End Sub

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