HtmlTextWriter.RenderAfterContent 메서드

정의

태그 요소의 내용 뒤와 닫는 태그 앞에 있는 텍스트나 공백을 태그 출력 스트림에 씁니다.

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

반환

String

요소의 내용 뒤에 있는 쓸 공백이나 텍스트가 포함된 문자열입니다.

예제

다음 코드 예제에서는 클래스에서 파생된 클래스의 RenderAfterContent 메서드를 재정의 HtmlTextWriter 하여 요소가 렌더링되는지 여부를 <label> 확인하는 방법을 보여줍니다. 이 경우 재정의는 RenderAfterContent 요소의 <font> 닫는 태그 바로 앞에 요소의 닫는 태그를 삽입합니다 <label> . 렌더링 RenderAfterContent 되는 요소가 아닌 <label> 다른 요소가 있으면 기본 메서드가 사용됩니다.

// Override the RenderAfterContent method to render
// the closing tag of a font element if the
// rendered tag is a label element.

virtual String^ RenderAfterContent() override
{
   
   // Check to determine whether the element being rendered
   // is a label element. If so, render the closing tag
   // of the font element; otherwise, call the base method.
   if ( TagKey == HtmlTextWriterTag::Label )
   {
      return "</font>";
   }
   else
   {
      return __super::RenderAfterContent();
   }
}
// Override the RenderAfterContent method to render
// the closing tag of a font element if the 
// rendered tag is a label element.
protected override string RenderAfterContent()
{
    // Check to determine whether the element being rendered
    // is a label element. If so, render the closing tag
    // of the font element; otherwise, call the base method.
    if (TagKey == HtmlTextWriterTag.Label)
    {
        return "</font>";
    }
    else
    {
        return base.RenderAfterContent();
    }
}
' Override the RenderAfterContent method to render
' the closing tag of a font element if the 
' rendered tag is a label element.
Protected Overrides Function RenderAfterContent() As String
    ' Check to determine whether the element being rendered
    ' is a label element. If so, render the closing tag
    ' of the font element; otherwise, call the base method.
    If TagKey = HtmlTextWriterTag.Label Then
        Return "</font>"
    Else
        Return MyBase.RenderAfterContent()
    End If
End Function 'RenderAfterContent

설명

이 메서드는 RenderAfterContent 현재 태그 요소에 자식 요소를 삽입하려는 경우에 유용할 수 있습니다.

상속자 참고

메서드의 클래스 구현이 HtmlTextWriter RenderAfterContent() 반환됩니다 null. 요소 콘텐츠 뒤와 닫는 태그 앞에 텍스트나 간격을 쓰려는 경우 재정 RenderAfterContent() 의합니다.

적용 대상

추가 정보