Compartir vía


HtmlTextWriter.InnerWriter Propiedad

Definición

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

public:
 property System::IO::TextWriter ^ InnerWriter { System::IO::TextWriter ^ get(); void set(System::IO::TextWriter ^ value); };
public System.IO.TextWriter InnerWriter { get; set; }
member this.InnerWriter : System.IO.TextWriter with get, set
Public Property InnerWriter As TextWriter

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 .

   // 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( String::Concat( Message, "<br> The time on the server : ", System::DateTime::Now.ToLongTimeString() ) );
   
   // Write the closing tag of the Font element.
   writer->WriteEndTag( "font" );
}
    // 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");
}
        ' 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.
        Dim innerTextWriter As TextWriter = 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")
    End Sub
End Class

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

Consulte también