Export (0) Print
Expand All

WebControlAdapter Class

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

Customizes rendering for the Web control to which the control adapter is attached, to modify the default markup or behavior for specific browsers.

Namespace: System.Web.UI.WebControls.Adapters
Assembly: System.Web (in system.web.dll)

'Declaration
Public Class WebControlAdapter
	Inherits ControlAdapter
'Usage
Dim instance As WebControlAdapter

public class WebControlAdapter extends ControlAdapter
public class WebControlAdapter extends ControlAdapter

The WebControl class is the base class from which Web controls inherit. It defines many properties common to all Web controls. For more information, see WebControl.

A WebControlAdapter object is a component that substitutes certain WebControl class or inherited methods and events in its execution life cycle to allow browser- or markup-specific handling. The .NET Framework maps a single control adapter to a derived WebControl object for each client request.

An adapter modifies a control behavior for a specific browser or class of browsers or acts as an arbitrary filter on some capability. Much of the adaptability in rendering behavior can be encapsulated in the specialized classes that derive from the HtmlTextWriter class. Therefore, it is likely that a single adapter can be used for a number of browser class behaviors or that inclusion of the adaptability in the HtmlTextWriter classes might make the use of a control adapter unnecessary.

Controls themselves do not necessarily require an adapter. If controls are extended through composition, generally the adapters for the child controls are sufficient.

Each control has explicit mappings to adapters through the .browser definition files. Thus, any access to the Adapter property of WebControl uses the HttpBrowserCapabilities object extracted from the .browser definition files to perform the lookup for the mapping of the adapter to control.

During processing, the .NET Framework intercepts calls to the overridable methods of a control that could be target-specific. If a control adapter is attached, the .NET Framework calls the associated adapter methods. For more information, see ControlAdapter.

The rendering for a WebControl typically consists of a beginning and ending tag, and some inner markup between the beginning and ending tags. The tags are defined when the WebControl is created. For more information, see WebControl.

The tags are generated by the RenderBeginTag and RenderEndTag methods, respectively. The inner markup is generated by the RenderContents method.

The Render method generates all markup, by calling methods in the following order:

  1. RenderBeginTag.

  2. RenderContents.

  3. RenderEndTag.

The IsEnabled property returns true only if the WebControl and all its parent controls are enabled. The Control property returns a strongly typed reference to the WebControl.

  • AspNetHostingPermission  for verifying at compilation time that the immediate caller into WebControlAdapter has this permission. Associated enumerations: LinkDemand, Minimal
  • AspNetHostingPermission  for verifying at load time that the class derived from WebControlAdapter has this permission. Associated enumerations: InheritanceDemand, 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

Community Additions

ADD
Show:
© 2014 Microsoft