次の方法で共有


TemplatedControlDesigner.GetTemplateContent メソッド

派生クラスでオーバーライドされると、テンプレートの内容を取得します。

Public MustOverride Function GetTemplateContent( _
   ByVal editingFrame As ITemplateEditingFrame, _   ByVal templateName As String, _   <Out()> ByRef allowEditing As Boolean _) As String
[C#]
public abstract string GetTemplateContent(ITemplateEditingFrameeditingFrame,stringtemplateName,   out boolallowEditing);
[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;

パラメータ

  • editingFrame
    内容が取得されるテンプレート編集フレーム。
  • templateName
    テンプレートの名前。
  • allowEditing
    テンプレートの内容を編集できる場合は true 。内容が読み取り専用の場合は false

戻り値

テンプレートの内容。

使用例

[Visual Basic] GetTemplateContent メソッドをオーバーライドして、テンプレートの名前と内容を設定し、テンプレートの編集を許可するコード例を次に示します。

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

必要条件

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

.NET Framework セキュリティ:

参照

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