HtmlTextWriter.InnerWriter Vlastnost
Definice
Důležité
Některé informace platí pro předběžně vydaný produkt, který se může zásadně změnit, než ho výrobce nebo autor vydá. Microsoft neposkytuje žádné záruky, výslovné ani předpokládané, týkající se zde uváděných informací.
Získá nebo nastaví textový zapisovač, který zapisuje vnitřní obsah prvku značky.
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
Hodnota vlastnosti
A TextWriter , který zapisuje vnitřní obsah revizí.
Příklady
Následující příklad kódu ukazuje, jak použít vlastní ovládací prvek webového serveru odvozený z WebControl třídy, který přepíše metodu Render . Používá třídu HtmlTextWriter k zápisu elementu <font> . Jakmile zapíše počáteční značku elementu, použije InnerWriter vlastnost k zápisu řetězce "<br> The time on the server:" a zřetězení tohoto řetězce s hodnotou DateTime.Now vlastnosti.
// 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
Poznámky
Vnitřní obsah revizí je text nalezený mezi levou a pravou značkou elementu jazyka značek.
InnerWriter Pokud je vlastnost nastavena na TextWriter objekt, který je instance HttpWriter třídy, je tento fakt zaznamenán a samostatný odkaz je uložen.