HtmlTextWriter.RenderAfterTag メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HtmlTextWriter.RenderAfterTag メソッドの意味・解説 

HtmlTextWriter.RenderAfterTag メソッド

マークアップ要素終了タグの後に出現する空白文字またはテキスト書き込みます

名前空間: System.Web.UI
アセンブリ: System.Web (system.web.dll 内)
構文構文

解説解説

RenderAfterTag メソッドは、要素タグの後に終了タグ追加して出力する場合に便利です。

継承時の注意 HtmlTextWriter クラス実装されている RenderAfterTag メソッドは、null 参照 (Visual Basic では Nothing) を返します要素終了タグの後にテキストまたは空白文字書き込む場合は、RenderAfterTagオーバーライドます。

使用例使用例

RenderAfterTag メソッドオーバーライドして、HtmlTextWriter クラスから派生したクラス<label> 要素出力するかどうか確認する方法次のコード例示します出力する場合は、RenderAfterTag オーバーライド<label> 要素直後に、<font> 要素終了タグ挿入します<label> 要素ない場合は、RenderAfterTag 基本メソッド使用されます。

    ' Override the RenderAfterTag method to add the 
    ' closing tag of the Font element after the 
    ' closing tag of a Label element has been rendered.
    Protected Overrides Function
 RenderAfterTag() As String
        ' Compare the TagName property value to the
        ' string label to determine whether the element to 
        ' be rendered is a Label. If it is a Label,
        ' the closing tag of a Font element is rendered
        ' after the closing tag of the Label element.
        If String.Compare(TagName, "label")
 = 0 Then
            Return "</font>"
            ' If a Label is not being rendered, use 
            ' the base RenderAfterTag method.
        Else
            Return MyBase.RenderAfterTag()
        End If
    End Function 'RenderAfterTag
End Class 'htwFour 
// Override the RenderAfterTag method to add the 
// closing tag of the Font element after the 
// closing tag of a Label element has been rendered.
protected override string RenderAfterTag()
{
    // Compare the TagName property value to the
    // string label to determine whether the element to 
    // be rendered is a Label. If it is a Label,
    // the closing tag of a Font element is rendered
    // after the closing tag of the Label element.
    if (String.Compare(TagName, "label") == 0)
    {
        return "</font>";
    }
    // If a Label is not being rendered, use 
        // the base RenderAfterTag method.
    else
    {
        return base.RenderAfterTag();
    }
}
// Override the RenderAfterTag method to add the
// closing tag of the Font element after the
// closing tag of a Label element has been rendered.
virtual String^ RenderAfterTag() override
{
   // Compare the TagName property value to the
   // String* label to determine whether the element to
   // be rendered is a Label. If it is a Label,
   // the closing tag of a Font element is rendered
   // after the closing tag of the Label element.
   if ( String::Compare( TagName, "label" ) == 0 )
   {
      return "</font>";
   }
   // If a Label is not being rendered, use
   // the base RenderAfterTag method.
   else
   {
      return __super::RenderAfterTag();
   }
}
// Override the RenderAfterTag method to add the 
// closing tag of the Font element after the 
// closing tag of a Label element has been rendered.
protected String RenderAfterTag()
{
    // Compare the TagName property value to the
    // string label to determine whether the element to 
    // be rendered is a Label. If it is a Label,
    // the closing tag of a Font element is rendered
    // after the closing tag of the Label element.
    if (String.Compare(get_TagName(), "label") == 0)
 {
        return "</font>";
    }
        // If a Label is not being rendered, use 
        // the base RenderAfterTag method.
    else {
        return super.RenderAfterTag();
    }
} //RenderAfterTag
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter


このページでは「.NET Framework クラス ライブラリ リファレンス」からHtmlTextWriter.RenderAfterTag メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からHtmlTextWriter.RenderAfterTag メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からHtmlTextWriter.RenderAfterTag メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

HtmlTextWriter.RenderAfterTag メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HtmlTextWriter.RenderAfterTag メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS