DataBoundControlAdapter Class
Customizes the behavior of a DataBoundControl object with which the adapter is associated for specific browser requests.
System.Web.UI.Adapters::ControlAdapter
System.Web.UI.WebControls.Adapters::WebControlAdapter
System.Web.UI.WebControls.Adapters::DataBoundControlAdapter
Assembly: System.Web (in System.Web.dll)
The DataBoundControlAdapter type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DataBoundControlAdapter | Infrastructure. Initializes a new instance of the DataBoundControlAdapter class. |
| Name | Description | |
|---|---|---|
![]() | Browser | Gets a reference to the browser capabilities of the client making the current HTTP request. (Inherited from ControlAdapter.) |
![]() | Control | Retrieves a strongly-typed reference to the DataBoundControl object associated with this control adapter. |
![]() | IsEnabled | Gets a value indicating whether the Web control and all its parent controls are enabled. (Inherited from WebControlAdapter.) |
![]() | 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.) |
| Name | Description | |
|---|---|---|
![]() | BeginRender | 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 | 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.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | LoadAdapterControlState | 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 | 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 | Overrides the OnInit method for the associated control. (Inherited from ControlAdapter.) |
![]() | OnLoad | Overrides the OnLoad method for the associated control. (Inherited from ControlAdapter.) |
![]() | OnPreRender | Overrides the OnPreRender method for the associated control. (Inherited from ControlAdapter.) |
![]() | OnUnload | Overrides the OnUnload method for the associated control. (Inherited from ControlAdapter.) |
![]() | PerformDataBinding | Binds the data in the data source of the associated DataBoundControl object to the control adapter. |
![]() | Render | Generates the target-specific markup for the control to which the control adapter is attached. (Inherited from WebControlAdapter.) |
![]() | RenderBeginTag | Creates the beginning tag for the Web control in the markup that is transmitted to the target browser. (Inherited from WebControlAdapter.) |
![]() | RenderChildren | Generates the target-specific markup for the child controls in a composite control to which the control adapter is attached. (Inherited from ControlAdapter.) |
![]() | RenderContents | Generates the target-specific inner markup for the Web control to which the control adapter is attached. (Inherited from WebControlAdapter.) |
![]() | RenderEndTag | Creates the ending tag for the Web control in the markup that is transmitted to the target browser. (Inherited from WebControlAdapter.) |
![]() | 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.) |
A control derived from the DataBoundControl class is bound to a data source and generates its user interface or child control hierarchy by enumerating the items in the data source to which it is bound. DataBoundControl is an abstract base class that defines the common characteristics of all controls that can be bound to a data source, such as the DataGrid and ListBox controls. For more information, see DataBoundControl.
A DataBoundControlAdapter modifies the behavior of a DataBoundControl for a specific browser or class of browsers, or acts as a 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 can make the use of a control adapter unnecessary.
Each control has explicit mappings to adapters through the .browser definition files, if there are <controlAdapter> entries in these files. Thus, any access to the Adapter property of the DataBoundControl 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 methods of a control that could be browser specific. If a control adapter is attached, the .NET Framework calls the associated adapter methods. For more information, see ControlAdapter.
The M:System.Web.UI.WebControls.Adapters.DataBoundControlAdapter.PerformDataBinding(System.Collections.IEnumerable) method binds an enumerable collection to the associated DataBoundControl. The Control property returns a strongly typed reference to the DataBoundControl.
The following code examples create and use two derived controls:
The MyDataBound class, derived from DataBoundControl, is a simple read-only grid control.
The MyDataBoundAdapter class, derived from DataBoundControlAdapter, renders the grid data as a one-dimensional list with row separators, suitable for small screen browsers.
The first code example uses a Web page to declare a MyDataBound control and an instance of ObjectDataSource that provides data in the form of a DataView object.
The second code example contains the derived MyDataBound and MyDataBoundAdapter classes:
The MyDataBound class overrides the PerformDataBinding method to save an IEnumerator collection for the data source, and overrides the RenderContents method to render the data source as an HTML <table>.
The MyDataBoundAdapter class overrides PerformDataBinding to save the data source to a one-dimensional ArrayList and add row separators. It overrides RenderContents to render the ArrayList as a list of fields separated by <br /> tags.
The third code example uses a configuration file to specify that no control adapter is to be used with MyDataBound controls for Microsoft Internet Explorer browsers, and that a MyDataBoundAdapter is used with MyDataBound controls for Openwave UP browsers.
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.


