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

Dim returnValue As String returnValue = Me.RenderBeforeTag
マークアップ要素の開始タグの前に書き込むテキストまたは空白文字。オーバーライドされない場合は null 参照 (Visual Basic では Nothing)。

RenderBeforeTag メソッドは、対象とする要素の開始タグの前に開始タグを追加して出力する場合に便利です。
実装時の注意 HtmlTextWriter クラスで実装されている RenderBeforeTag メソッドは、null 参照 (Visual Basic では Nothing) を返します。要素の開始タグの前にテキストまたは空白文字を書き込む場合は、RenderBeforeTag をオーバーライドします。
RenderBeforeTag メソッドをオーバーライドして、HtmlTextWriter クラスから派生したクラスが <label> 要素を出力するかどうかを確認する方法を次のコード例に示します。出力する場合は、RenderBeforeTag オーバーライドが <label> 要素の直前に、<font> 要素の開始タグを挿入します。<label> 要素を出力しない場合は、RenderBeforeTag 基本メソッドが使用されます。
' Override the RenderBeforeTag method to add the ' opening tag of a Font element before the ' opening tag of any Label elements rendered by this ' custom markup writer. Protected Overrides Function RenderBeforeTag() 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 opening tag of the Font element, with a Color ' style attribute set to red, is added before ' the Label. If String.Compare(TagName, "label") = 0 Then Return "<font color=""red"">" ' If a Label is not being rendered, use ' the base RenderBeforeTag method. Else Return MyBase.RenderBeforeTag() End If End Function 'RenderBeforeTag
// Override the RenderBeforeTag method to add the // opening tag of a Font element before the // opening tag of any Label elements rendered by this // custom markup writer. protected override string RenderBeforeTag() { // 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 opening tag of the Font element, with a Color // style attribute set to red, is added before // the Label. if (String.Compare(TagName, "label") == 0) { return "<font color=\"red\">"; } // If a Label is not being rendered, use // the base RenderBeforeTag method. else { return base.RenderBeforeTag(); } }
// Override the RenderBeforeTag method to add the // opening tag of a Font element before the // opening tag of any Label elements rendered by this // custom markup writer. virtual String^ RenderBeforeTag() 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 opening tag of the Font element, with a Color // style attribute set to red, is added before // the Label. if ( String::Compare( TagName, "label" ) == 0 ) { return "<font color=\"red\">"; } // If a Label is not being rendered, use // the base RenderBeforeTag method. else { return __super::RenderBeforeTag(); } }
// Override the RenderBeforeTag method to add the // opening tag of a Font element before the // opening tag of any Label elements rendered by this // custom markup writer. protected String RenderBeforeTag() { // 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 opening tag of the Font element, with a Color // style attribute set to red, is added before // the Label. if (String.Compare(get_TagName(), "label") == 0) { return "<font color=\"red\">"; } // If a Label is not being rendered, use // the base RenderBeforeTag method. else { return super.RenderBeforeTag(); } } //RenderBeforeTag

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からHtmlTextWriter.RenderBeforeTag メソッドを検索する場合は、下記のリンクをクリックしてください。

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