HtmlTextWriter.RenderBeforeContent メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim returnValue As String returnValue = Me.RenderBeforeContent
要素の内容の前に書き込むテキストまたは空白文字。オーバーライドされない場合、RenderBeforeContent は null 参照 (Visual Basic では Nothing) を返します。

RenderBeforeContent メソッドは、子要素を現在のマークアップ要素の内部マークアップの前に挿入する場合に役立ちます。
継承時の注意 HtmlTextWriter クラスで実装されている RenderBeforeContent メソッドは、null 参照 (Visual Basic では Nothing) を返します。開始タグの後、要素の内容の前にテキストまたは空白文字を書き込む場合は、RenderBeforeContent をオーバーライドします。
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

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HtmlTextWriter.RenderBeforeContent メソッドのページへのリンク