HTML Adapter Set

The HTML adapter set renders ASP.NET mobile Web pages on clients that are capable of rendering HTML 3.2 with scripting enabled, such as Microsoft Internet Explorer for the Pocket PC.

The following table lists the core classes that are included in the HTML adapter set.

Adapter set

Core adapter class namespace

ControlAdapter abstract base class

HtmlControlAdapter

HtmlControlAdapter class

HtmlFormAdapter

PageAdapter abstract class

HtmlControlAdapter

MobileTextWriter class

HtmlMobileTextWriter

Selection

The HTML adapter set is selected if the PreferredRenderingType property of the MobileCapabilities class returns PreferredRenderingTypeHtml32 and the JavaScript property of the browser capabilities class returns true.

Default Rendering

The following describes the default rendering of the page and form adapter classes in the HTML adapter set.

The page adapter performs the following steps:

  1. Calls the BeginResponse and BeginFile methods on the writer. Content type is text/html.

  2. Writes out an opening <html> tag.

  3. Renders the active form.

  4. Writes out a closing </html> tag.

  5. Calls the EndFile and EndResponse methods.

The form adapter performs the following steps:

  1. Writes out a <title> element, if one is required.

  2. Writes out <body> and <form> tags.

  3. Writes out hidden and internal form variables, and postback script.

  4. Renders form contents.

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

Using Styles

The HtmlMobileTextWriter class provides a number of helper methods that aid in using style information to control character and layout appearance:

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

The breakAfter parameter of the ExitLayout(Style, Boolean), ExitFormat(Style, Boolean), and ExitStyle(Style, Boolean) methods controls whether a break is inserted after the format and layout tags. If this parameter is set to true, a logical break appears in the output using either a <br> or <div> element.

Rendering Postbacks

Form postbacks are rendered as calls to client script that is written out with the form.

To render a postback event as an anchor for an adapter, you can call the RenderPostBackEventAsAnchor method of the HtmlControlAdapter base class. This method writes out an <a> tag and generates a postback when the user clicks the link.

To render a postback event as an attribute of another tag for a control adapter, you can call the RenderPostBackEventAsAttribute method. You can use this method as part of other tags; 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 form postbacks.

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

Secondary UI

The HTML adapter set supports a concept called secondary UI. Secondary UI is used by controls that show additional screens of a 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 HtmlControlAdapter base class.

  2. In rendering, the control checks whether it is in secondary UI mode, and if so, it 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 HtmlControlAdapter base class.

See Also

Concepts

Adapter Sets Functionality