XhtmlMobileTextWriter Class

Note: This class is new in the .NET Framework version 2.0.

Provides text writer functionality for devices targeted by the XHTML adapter set, including XHTML, XHTML Mobile, and WML.

Namespace: System.Web.UI.MobileControls.Adapters.XhtmlAdapters
Assembly: System.Web.Mobile (in system.web.mobile.dll)

public class XhtmlMobileTextWriter : MobileTextWriter
public class XhtmlMobileTextWriter extends MobileTextWriter
public class XhtmlMobileTextWriter extends MobileTextWriter

Extensible Hypertext Markup Language, or XHTML, is an XML-compliant markup that is based on HTML 4.1 and allows you to create Web sites suitable for multiple device types. It merges HTML's ease of use with XML's strict element guidelines to produce a markup language with a wide range of format and style options and reduced markup tag ambiguity. This class provides formatting capabilities that ASP.NET server controls use when rendering XHTML content to clients. The XhtmlMobileTextWriter renders markup that meets the standards of three different XHTML doc types: XHTML Basic, which supports limited style and format elements; XHTML Mobile Profile, which supports inline style sheets; and WML 2.0, which is based on XHTML 1.1 and supports cascading style sheets.

This class is used primarily by developers of custom mobile page and control adapters.

The XhtmlMobileTextWriter class can render all HTML elements, attributes and style attributes, but, unlike the HtmlTextWriter class, does not allow title capitalization of these markup elements.

An XhtmlPageAdapter instantiates an XhtmlMobileTextWriter and depending on the capabilities of the target device, initializes a number of properties such as SupportsNoWrapStyle, SuppressNewLine, and UseDivsForBreaks, that assist the text writer in rendering the page and its controls.

Your adapter can use a variety of methods to apply styles and control formatting:

You can use the members of this class, and any members it inherits from the MobileTextWriter class, to create custom text writers to use in a custom XHTML page or in class adapters. You can also create new derived classes that override the standard behavior of the XhtmlMobileTextWriter class.

Device filtering is required in order to use a specific adapter or text writer for a server control. For more information about device filtering, see Architectural Overview of Adaptive Control Behavior and ASP.NET Device Filtering Overview.

  • AspNetHostingPermission  for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
  • AspNetHostingPermission  for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0