Export (0) Print
Expand All

WebControlAdapter Class

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)

type WebControlAdapter =  
    class
        inherit ControlAdapter
    end

The WebControlAdapter type exposes the following members.

  NameDescription
Public methodWebControlAdapterInfrastructure. Initializes a new instance of the WebControlAdapter class.
Top

  NameDescription
Protected propertyBrowserGets a reference to the browser capabilities of the client making the current HTTP request. (Inherited from ControlAdapter.)
Protected propertyControlGets a reference to the Web control to which this control adapter is attached.
Protected propertyIsEnabledGets a value indicating whether the Web control and all its parent controls are enabled.
Protected propertyPageGets a reference to the page where the control associated with this adapter resides. (Inherited from ControlAdapter.)
Protected propertyPageAdapterGets a reference to the page adapter for the page where the associated control resides. (Inherited from ControlAdapter.)
Top

  NameDescription
Protected methodBeginRenderCalled prior to the rendering of a control. In a derived adapter class, generates opening tags that are required by a specific target but not needed by HTML browsers. (Inherited from ControlAdapter.)
Protected methodCreateChildControlsCreates the target-specific child controls for a composite control. (Inherited from ControlAdapter.)
Protected methodEndRenderCalled after the rendering of a control. In a derived adapter class, generates closing tags that are required by a specific target but not needed by HTML browsers. (Inherited from ControlAdapter.)
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodLoadAdapterControlStateLoads adapter control state information that was saved by SaveAdapterControlState during a previous request to the page where the control associated with this control adapter resides. (Inherited from ControlAdapter.)
Protected methodLoadAdapterViewStateLoads adapter view state information that was saved by SaveAdapterViewState during a previous request to the page where the control associated with this control adapter resides. (Inherited from ControlAdapter.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodOnInitOverrides the OnInit method for the associated control. (Inherited from ControlAdapter.)
Protected methodOnLoadOverrides the OnLoad method for the associated control. (Inherited from ControlAdapter.)
Protected methodOnPreRenderOverrides the OnPreRender method for the associated control. (Inherited from ControlAdapter.)
Protected methodOnUnloadOverrides the OnUnload method for the associated control. (Inherited from ControlAdapter.)
Protected methodRenderGenerates the target-specific markup for the control to which the control adapter is attached. (Overrides ControlAdapter.Render(HtmlTextWriter).)
Protected methodRenderBeginTagCreates the beginning tag for the Web control in the markup that is transmitted to the target browser.
Protected methodRenderChildrenGenerates the target-specific markup for the child controls in a composite control to which the control adapter is attached. (Inherited from ControlAdapter.)
Protected methodRenderContentsGenerates the target-specific inner markup for the Web control to which the control adapter is attached.
Protected methodRenderEndTagCreates the ending tag for the Web control in the markup that is transmitted to the target browser.
Protected methodSaveAdapterControlStateSaves control state information for the control adapter. (Inherited from ControlAdapter.)
Protected methodSaveAdapterViewStateSaves view state information for the control adapter. (Inherited from ControlAdapter.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

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

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

Community Additions

ADD
Show:
© 2014 Microsoft