HtmlTextWriter.RenderAfterContent Método

Definição

Grava qualquer texto ou espaçamento que ocorre após o conteúdo e antes da marca de fechamento do elemento de marcação no fluxo de saída de marcação.

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

Retornos

String

Uma cadeia de caracteres que contém o espaçamento ou o texto a ser gravado após o conteúdo do elemento.

Exemplos

O exemplo de código a seguir mostra como substituir o RenderAfterContent método em uma classe derivada da HtmlTextWriter classe para determinar se um <label> elemento está sendo renderizado. Nesse caso, a RenderAfterContent substituição insere a marca de fechamento de um <font> elemento imediatamente antes da marca de fechamento do <label> elemento. Se um elemento diferente de <label> estiver sendo renderizado, o RenderAfterContent método base será usado.

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

Comentários

O RenderAfterContent método pode ser útil se você quiser inserir elementos filho no elemento de marcação atual.

Notas aos Herdeiros

A HtmlTextWriter implementação de classe do RenderAfterContent() método retorna null. Substitua RenderAfterContent() se você quiser escrever texto ou espaçamento após o conteúdo do elemento, mas antes da marca de fechamento.

Aplica-se a

Confira também