次の方法で共有


TemplatedControlDesigner.SetTemplateContent メソッド

派生クラスでオーバーライドされた場合は、指定されたテンプレートの内容を、指定された内容に設定します。

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

パラメータ

  • editingFrame
    内容を提供する対象のテンプレート編集フレーム。
  • templateName
    テンプレートの名前。
  • templateContent
    テンプレートに設定する内容。

使用例

[Visual Basic] SetTemplateContent メソッドをオーバーライドして、 templateContent パラメータに null 参照 (Visual Basic では Nothing) 値が渡されたかどうかをチェックするコード例を次に示します。 null 参照 (Nothing) 値が渡されていない場合は、 GetTemplateFromText メソッドを使用して、 templateContent パラメータの値になっているテンプレートと等価のテンプレートを設定します。

 
' 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] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

TemplatedControlDesigner クラス | TemplatedControlDesigner メンバ | System.Web.UI.Design 名前空間