HtmlTextWriter.InnerWriter Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan atau mengatur penulis teks yang menulis konten dalam elemen markup.
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
Nilai Properti
Yang TextWriter menulis konten markup dalam.
Contoh
Contoh kode berikut menunjukkan cara menggunakan kontrol server Web kustom, berasal dari WebControl kelas , yang mengambil alih Render metode . Ini menggunakan HtmlTextWriter kelas untuk menulis <font> elemen. Setelah menulis tag pembuka elemen, ia menggunakan InnerWriter properti untuk menulis string "<br> The time on the server:" dan menggabungkan string ini dengan nilai DateTime.Now properti .
// 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
Keterangan
Konten markup dalam adalah teks yang ditemukan antara tag pembuka dan penutup elemen bahasa markup.
InnerWriter Jika properti diatur ke TextWriter objek yang merupakan instans HttpWriter kelas, fakta ini dicatat dan referensi terpisah disimpan.