WebControlAdapter Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Customizes rendering for the Web control to which the control adapter is attached, to modify the default markup or behavior for specific browsers.
public ref class WebControlAdapter : System::Web::UI::Adapters::ControlAdapter
public class WebControlAdapter : System.Web.UI.Adapters.ControlAdapter
type WebControlAdapter = class
inherit ControlAdapter
Public Class WebControlAdapter
Inherits ControlAdapter
- Inheritance
- Derived
Remarks
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:
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.
Constructors
WebControlAdapter() |
Initializes a new instance of the WebControlAdapter class. |
Properties
Browser |
Gets a reference to the browser capabilities of the client making the current HTTP request. (Inherited from ControlAdapter) |
Control |
Gets a reference to the Web control to which this control adapter is attached. |
IsEnabled |
Gets a value indicating whether the Web control and all its parent controls are enabled. |
Page |
Gets a reference to the page where the control associated with this adapter resides. (Inherited from ControlAdapter) |
PageAdapter |
Gets a reference to the page adapter for the page where the associated control resides. (Inherited from ControlAdapter) |
Methods
BeginRender(HtmlTextWriter) |
Called 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) |
CreateChildControls() |
Creates the target-specific child controls for a composite control. (Inherited from ControlAdapter) |
EndRender(HtmlTextWriter) |
Called 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) |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
LoadAdapterControlState(Object) |
Loads 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) |
LoadAdapterViewState(Object) |
Loads 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) |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
OnInit(EventArgs) |
Overrides the OnInit(EventArgs) method for the associated control. (Inherited from ControlAdapter) |
OnLoad(EventArgs) |
Overrides the OnLoad(EventArgs) method for the associated control. (Inherited from ControlAdapter) |
OnPreRender(EventArgs) |
Overrides the OnPreRender(EventArgs) method for the associated control. (Inherited from ControlAdapter) |
OnUnload(EventArgs) |
Overrides the OnUnload(EventArgs) method for the associated control. (Inherited from ControlAdapter) |
Render(HtmlTextWriter) |
Generates the target-specific markup for the control to which the control adapter is attached. |
RenderBeginTag(HtmlTextWriter) |
Creates the beginning tag for the Web control in the markup that is transmitted to the target browser. |
RenderChildren(HtmlTextWriter) |
Generates the target-specific markup for the child controls in a composite control to which the control adapter is attached. (Inherited from ControlAdapter) |
RenderContents(HtmlTextWriter) |
Generates the target-specific inner markup for the Web control to which the control adapter is attached. |
RenderEndTag(HtmlTextWriter) |
Creates the ending tag for the Web control in the markup that is transmitted to the target browser. |
SaveAdapterControlState() |
Saves control state information for the control adapter. (Inherited from ControlAdapter) |
SaveAdapterViewState() |
Saves view state information for the control adapter. (Inherited from ControlAdapter) |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |