Customizes rendering for the Web control to which the control adapter is attached, to modify the default markup or behavior for specific browsers.
See Also: WebControlAdapter Members
The System.Web.UI.WebControls.WebControl class is the base class from which Web controls inherit. It defines many properties common to all Web controls. For more information, see System.Web.UI.WebControls.WebControl.
A System.Web.UI.WebControls.Adapters.WebControlAdapter object is a component that substitutes certain System.Web.UI.WebControls.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 System.Web.UI.WebControls.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 System.Web.UI.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 System.Web.UI.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 System.Web.UI.Control.Adapter property of System.Web.UI.WebControls.WebControl uses the System.Web.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 System.Web.UI.Adapters.ControlAdapter.
The rendering for a System.Web.UI.WebControls.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 System.Web.UI.WebControls.WebControl is created. For more information, see erload:System.Web.UI.WebControls.WebControl.#ctor.
The tags are generated by the WebControlAdapter.RenderBeginTag(System.Web.UI.HtmlTextWriter) and WebControlAdapter.RenderEndTag(System.Web.UI.HtmlTextWriter) methods, respectively. The inner markup is generated by the WebControlAdapter.RenderContents(System.Web.UI.HtmlTextWriter) method.
The WebControlAdapter.Render(System.Web.UI.HtmlTextWriter) method generates all markup, by calling methods in the following order:[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]
The WebControlAdapter.IsEnabled property returns true only if the System.Web.UI.WebControls.WebControl and all its parent controls are enabled. The WebControlAdapter.Control property returns a strongly typed reference to the System.Web.UI.WebControls.WebControl.