XHTML Adapter Set

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

The XHTML adapter set renders ASP.NET mobile Web pages on clients that are capable of rendering XHTML Basic and XHTML, such as Microsoft Internet Explorer for the Pocket PC.

The following table lists the adapter set classes, a property that returns a class, and the core classes that are included in the XHTML adapter set.

Adapter set class or property

Core adapter class

ControlAdapter (base class)

XhtmlControlAdapter

FormAdapter

XhtmlFormAdapter

PageAdapter

XhtmlPageAdapter

MobileTextWriter

XhtmlMobileTextWriter

Selection

The XHTML adapter set is selected if the preferred rendering type is "xhtml-basic", "xhtml-mp", or "wml20".

Note

In ASP.NET 2.0, the possible preferred rendering types for XHTML are not part of the MobileCapabilities class.

Default Rendering

During the default rendering of the page and form adapter classes in the XHTML adapter set, the page adapter performs the following steps.

  1. Calls the BeginResponse and BeginFile methods of the writer. The content type is set to "text/html".

  2. Writes an XML declaration (<? xml version=1.0 encoding="encodingType" ?>).

  3. Writes the XHTML document DTD reference.

  4. Writes an opening <html xmlns="https://www.w3.org/1999/xhtml" > tag.

  5. Renders the active form.

  6. Writes a closing </html> tag.

  7. Calls the EndFile and EndResponse methods.

The form adapter performs the following steps:

  1. Writes an opening title element, if one is required.

  2. Writes the opening <body> and <form> tags.

  3. Writes any hidden and internal form variables, and writes postback script.

  4. Renders form contents.

  5. Writes closing </form> and </body> tags.

Using Styles

The XhtmlMobileTextWriter class provides the following helper methods that aid in using style information to control aspects of character or layout appearance:

A number of properties determine which style properties are written. These properties (such as RenderBold, RenderItalic, and so on) are set when the writer is created, by using the device capabilities of the requesting device.

The breakAfter parameter of the ExitLayout, ExitFormat, and ExitStyle methods controls whether a break is inserted after the format and layout tags. If the breakAfter parameter is set to true, a logical break is rendered in the output using either a br or div element.

Rendering Postback Controls

By default, form postback controls are rendered as buttons. To use a link as a postback control, you can call the RenderPostBackEventAsAnchor method of the XhtmlControlAdapter base class. This method renders an a element that posts the form back when the user clicks the link.

You can also create a postback control by setting an attribute of other elements for a control adapter. To do so, you can call the RenderPostBackEventAsAttribute method. For example, you can use the method to create an onClick attribute for a button.

Links to other pages are rendered as hyperlinks. Links to other forms on the same page are rendered as postback controls.

To render a link for a mobile control adapter, you can call the RenderBeginLink and RenderEndLink methods of the XhtmlControlAdapter base class. The RenderBeginLink method automatically checks for the type of link and renders the appropriate markup.

Secondary UI

The XHTML adapter set supports secondary UI, which is used by controls to show additional screens of the user interface. To use secondary UI, a control adapter performs the following steps:

  1. In response to some user interaction (usually in the overridable HandlePostBackEvent method), the control adapter specifies secondary UI mode by setting the SecondaryUIMode property of the XhtmlControlAdapter base class to an internally known constant.

  2. In rendering, the control checks whether it is in secondary UI mode, and if so, renders the appropriate secondary UI.

  3. In response to user interaction from the secondary UI, the control adapter might change the secondary UI mode to another value, or exit secondary UI mode by calling the ExitSecondaryUIMode method of the XhtmlControlAdapter base class.

See Also

Concepts

Adapter Sets Functionality