HtmlTextWriter.RenderAfterTag 메서드

정의

태그 요소의 닫는 태그 뒤에 있는 공백이나 텍스트를 씁니다.

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

반환

String

요소의 닫는 태그 뒤에 있는 쓸 공백이나 텍스트입니다.

예제

다음 코드 예제에서는 클래스에서 파생 된 클래스 요소를 렌더링 하는지 여부를 확인 하는 메서드를 재정 RenderAfterTagHtmlTextWriter 하는 <label> 방법을 보여 집니다. 이 경우 재정의는 RenderAfterTag 요소 바로 뒤에 요소의 닫는 <font> 태그를 <label> 삽입합니다. 요소가 아닌 <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.
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

설명

이 메서드는 RenderAfterTag 요소 태그 다음에 추가 닫는 태그를 렌더링하려는 경우에 유용할 수 있습니다.

상속자 참고

메서드의 클래스 구현이 HtmlTextWriter RenderAfterTag() 반환됩니다 null. 요소 닫는 태그 뒤의 텍스트 또는 간격을 작성하려는 경우 재정 RenderAfterTag() 의합니다.

적용 대상

추가 정보