Html32TextWriter.RenderBeforeTag Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Grava qualquer espaçamento de texto ou guia que ocorra antes da marca de abertura de um elemento HTML no fluxo de saída HTML 3.2.
protected:
override System::String ^ RenderBeforeTag();
protected override string RenderBeforeTag();
override this.RenderBeforeTag : unit -> string
Protected Overrides Function RenderBeforeTag () As String
Retornos
A fonte HTML e as informações de espaçamento a serem renderizadas antes da marca; caso contrário, se não houver essas informações para renderizar, null.
Exemplos
O exemplo de código a seguir demonstra como substituir o RenderBeforeTag método. O código verifica se um a elemento está sendo renderizado. Nesse caso, o método substituído RenderBeforeTag grava a marca de abertura de um small elemento. O exemplo para o RenderAfterTag elemento executa a mesma verificação para o a elemento e grava a marca de fechamento do small elemento.
Este exemplo de código faz parte de um exemplo maior fornecido para a Html32TextWriter classe.
// Override the RenderBeforeTag method to render the
// opening tag of a <small> element to modify the text size of
// any <a> elements that this writer encounters.
protected override string RenderBeforeTag()
{
// Check whether the element being rendered is an
// <a> element. If so, render the opening tag
// of the <small> element; otherwise, call the base method.
if (TagKey == HtmlTextWriterTag.A)
return "<small>";
return base.RenderBeforeTag();
}
' Override the RenderBeforeTag method to render the
' opening tag of a <small> element to modify the text size of
' any <a> elements that this writer encounters.
Protected Overrides Function RenderBeforeTag() As String
' Check whether the element being rendered is an
' <a> element. If so, render the opening tag
' of the <small> element; otherwise, call the base method.
If TagKey = HtmlTextWriterTag.A Then
Return "<small>"
End If
Return MyBase.RenderBeforeTag()
End Function