ChtmlTextWriter Constructor (TextWriter)
Initializes a new instance of the ChtmlTextWriter class that uses the DefaultTabString constant to indent lines.
Assembly: System.Web (in System.Web.dll)
Parameters
- writer
-
Type:
System.IO.TextWriter
The TextWriter that renders the markup content.
The ChtmlTextWriter class has two constructors, which is standard for all classes that derive directly or indirectly from the HtmlTextWriter class.
The ChtmlTextWriter constructor, which takes an instance of the TextWriter class as a parameter, calls the second constructor and passes it two parameter values:
The TextWriter.
The string value that is specified in the DefaultTabString field, which defines the tab spacing that is used by the XHTML text writer.
The following code example demonstrates how to create a class named ChtmlCustomPageAdapter and defines one method, CreateCustomChtmlTextWriter, which creates and returns an instance of the CustomChtmlTextWriter class. The CustomChtmlTextWriter then renders cHTML content for pages to devices with browsers that use cHTML markup.
This code example is part of a larger example provided for the ChtmlTextWriter class.
// Derive from the WebControlAdapter class, // provide a CreateCustomChtmlTextWriter // method to attach to the custom writer. public class ChtmlCustomPageAdapter : WebControlAdapter { protected internal ChtmlTextWriter CreateCustomChtmlTextWriter( TextWriter writer) { return new CustomChtmlTextWriter(writer); } }
Available since 2.0