Export (0) Print
Expand All

ChtmlTextWriter Constructor (TextWriter)

Initializes a new instance of the ChtmlTextWriter class that uses the DefaultTabString constant to indent lines.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)

public ChtmlTextWriter(
	TextWriter writer
)

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);
		}
	}

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0

Community Additions

ADD
Show:
© 2014 Microsoft