This documentation is archived and is not being maintained.

TemplatedControlDesigner.SetTemplateContent Method

When overridden in a derived class, sets the specified template's content to the specified content.

[Visual Basic]
Public MustOverride Sub SetTemplateContent( _
   ByVal editingFrame As ITemplateEditingFrame, _
   ByVal templateName As String, _
   ByVal templateContent As String _
)
[C#]
public abstract void SetTemplateContent(
 ITemplateEditingFrame editingFrame,
 string templateName,
 string templateContent
);
[C++]
public: virtual void SetTemplateContent(
 ITemplateEditingFrame* editingFrame,
 String* templateName,
 String* templateContent
) = 0;
[JScript]
public abstract function SetTemplateContent(
   editingFrame : ITemplateEditingFrame,
 templateName : String,
 templateContent : String
);

Parameters

editingFrame
The template editing frame to provide content for.
templateName
The name of the template.
templateContent
The content to set for the template.

Example

[Visual Basic] The followiong code example overrides the SetTemplateContent method to check whether the templateContent paramater has been passed a a null reference (Nothing in Visual Basic) value. If it has not been passed a a null reference (Nothing) value, the code uses the GetTemplateFromText method to set the template equal to the templateContent parameter value's template.

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