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

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

HtmlTextWriter.RenderBeforeContent メソッド

マークアップ要素内容の前および開始タグの後にテキストまたは空白文字書き込みます

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

Protected Overridable Function
 RenderBeforeContent As String
Dim returnValue As String

returnValue = Me.RenderBeforeContent
protected virtual string RenderBeforeContent
 ()
protected:
virtual String^ RenderBeforeContent ()
protected String RenderBeforeContent ()
protected function RenderBeforeContent () :
 String

戻り値
要素内容前に書き込むテキストまたは空白文字オーバーライドされない場合RenderBeforeContentnull 参照 (Visual Basic では Nothing) を返します

解説解説
使用例使用例

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

' Override the RenderBeforeContent method to write
' a font element that applies red to the text in a Label element.
Protected Overrides Function
 RenderBeforeContent() As String
    ' Check to determine whether the element being rendered
    ' is a label element. If so, render the opening tag
    ' of the font element; otherwise, call the base method.
    If TagKey = HtmlTextWriterTag.Label Then
        Return "<font color=""red"">"
    Else
        Return MyBase.RenderBeforeContent()
    End If
End Function 'RenderBeforeContent

// Override the RenderBeforeContent method to write
// a font element that applies red to the text in a Label element.
protected override string RenderBeforeContent()
{
    // Check to determine whether the element being rendered
    // is a label element. If so, render the opening tag
    // of the font element; otherwise, call the base method.
    if (TagKey == HtmlTextWriterTag.Label)
    {
        return "<font color=\"red\">";
    }
    else
    {
        return base.RenderBeforeContent();
    }
}
// Override the RenderBeforeContent method to write
// a font element that applies red to the text in a Label element.

virtual String^ RenderBeforeContent() override
{
   
   // Check to determine whether the element being rendered
   // is a label element. If so, render the opening tag
   // of the font element; otherwise, call the base method.
   if ( TagKey == HtmlTextWriterTag::Label )
   {
      return "<font color=\"red\">";
   }
   else
   {
      return __super::RenderBeforeContent();
   }
}


// Override the RenderBeforeContent method to write
// a font element that applies red to the text in a Label element.
protected String RenderBeforeContent()
{
    // Check to determine whether the element being rendered
    // is a label element. If so, render the opening tag
    // of the font element; otherwise, call the base method.
    if (get_TagKey().Equals(HtmlTextWriterTag.Label)) {
        return "<font color=\"red\">";
    }
    else {
        return super.RenderBeforeContent();
    }
} //RenderBeforeContent
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter



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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS