HtmlTextWriter Constructor (TextWriter)
Initializes a new instance of the HtmlTextWriter class that uses a default tab string.
Assembly: System.Web (in System.Web.dll)
Parameters
- writer
- Type: System.IO::TextWriter
The TextWriter instance that renders the markup content.
The HtmlTextWriter overload of the HtmlTextWriter(TextWriter) constructor uses the DefaultTabString constant when indentation of a line is necessary. It calls the HtmlTextWriter(TextWriter, String) overload to initialize the new instance.
The following code example demonstrates how to use the HtmlTextWriter(TextWriter) constructor to create a custom HtmlTextWriter object named StyledLabelHtmlWriter. When the MyPage custom class, which is derived from the Page class, is requested by a client browser, it uses the StyledLabelHtmlWriter class to render its content to the output stream.
// A custom class that overrides its CreateHtmlTextWriter method. // This page uses the StyledLabelHtmlWriter class to render its content. public ref class MyPage: public Page { protected: virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override { return gcnew HtmlStyledLabelWriter( writer ); } };
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.