次の方法で共有


TemplatedControlDesigner.GetTextFromTemplate メソッド

指定したテンプレートを表すテキスト文字列を取得します。

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

パラメータ

  • template
    テキストに変換する ITemplate

戻り値

指定したテンプレートを表す文字列。

使用例

[Visual Basic] GetTemplateContent メソッドをオーバーライドして GetTextFromTemplate メソッドを呼び出すコード例を次に示します。この GetTextFromTemplate メソッドを呼び出すと、そのデザイナ用に前回作成されたテンプレートのテキスト表現が取得されます。

 
' 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 名前空間