HtmlTextWriter.InnerWriter Propiedad

Definición

Obtiene o establece el escritor de texto que escribe el contenido interno del elemento de marcado.

C#
public System.IO.TextWriter InnerWriter { get; set; }

Valor de propiedad

TextWriter

Objeto TextWriter que escribe el contenido de marcado interno.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar un control de servidor web personalizado, derivado de la WebControl clase , que invalida el Render método . Usa la HtmlTextWriter clase para escribir un <font> elemento. Después de escribir la etiqueta de apertura del elemento, usa la InnerWriter propiedad para escribir la cadena "<br> The time on the server:" y concatena esta cadena con el valor de la DateTime.Now propiedad .

C#
    // Write the opening tag of a Font element.
    writer.WriteBeginTag("font");
    // Write a Color style attribute to the opening tag
    // of the Font element and set its value to red.
    writer.WriteAttribute("color", "red");
    // Write the closing character for the opening tag of
    // the Font element.
    writer.Write('>');

    // Use the InnerWriter property to create a TextWriter
    // object that will write the content found between
    // the opening and closing tags of the Font element.
    // Message is a string property of the control that 
    // overrides the Render method.
    TextWriter innerTextWriter = writer.InnerWriter;
    innerTextWriter.Write(Message + "<br> The time on the server :" + System.DateTime.Now.ToLongTimeString());

    // Write the closing tag of the Font element.
    writer.WriteEndTag("font");
}

Comentarios

El contenido de marcado interno es el texto que se encuentra entre las etiquetas de apertura y cierre de un elemento de lenguaje de marcado.

Si la InnerWriter propiedad se establece en un TextWriter objeto que es una instancia de la HttpWriter clase , se indica este hecho y se guarda una referencia independiente.

Se aplica a

Produto Versións
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

Consulte también