HtmlTextWriter.RenderAfterTag HtmlTextWriter.RenderAfterTag HtmlTextWriter.RenderAfterTag HtmlTextWriter.RenderAfterTag Method

定義

マークアップ要素の終了タグの後に出現する空白文字またはテキストを書き込みます。Writes any spacing or text that occurs after the closing tag for a markup element.

protected:
 virtual System::String ^ RenderAfterTag();
protected virtual string RenderAfterTag ();
abstract member RenderAfterTag : unit -> string
override this.RenderAfterTag : unit -> string
Protected Overridable Function RenderAfterTag () As String

戻り値

要素の終了タグの後に書き込む空白文字またはテキスト。The spacing or text to write after the closing tag of the element.

次のコード例は、オーバーライドする方法を示します、RenderAfterTagクラスから派生したかどうかを判断するメソッド、HtmlTextWriterクラスをレンダリングする<label>要素。The following code example shows how to override the RenderAfterTag method to determine whether a class derived from the HtmlTextWriter class is rendering a <label> element. そうである場合、RenderAfterTag上書き挿入の終了タグ、<font>要素の直後に、<label>要素。If so, the RenderAfterTag override inserts the closing tag of a <font> element immediately after the <label> element. ない場合、<label>要素、RenderAfterTag基本メソッドを使用します。If it is not a <label> element, the RenderAfterTag base method is used.

// 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 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.
    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 

注釈

RenderAfterTagメソッドは要素のタグの後に追加の終了タグをレンダリングする役に立ちます。The RenderAfterTag method can be useful if you want to render additional closing tags after the element tag.

注意 (継承者)

HtmlTextWriterのクラスの実装、RenderAfterTag()メソッドを返します。nullします。The HtmlTextWriter class implementation of the RenderAfterTag() method returns null. オーバーライドRenderAfterTag()テキストまたは要素の終了タグの後の間隔を記述する場合。Override RenderAfterTag() if you want to write text or spacing after the element closing tag.

適用対象

こちらもご覧ください