Automatic Data Binding in Popup Control
- 3 minutes to read
ASPxPopupControl has a built-in ability to automatically retrieve data from a data source that supports one of the IListSource, IEnumerable, or IDataSource interfaces. This topic describes conditions that allow ASPxPopupControl to bind to data after specifying just one property (ASPxDataWebControlBase.DataSource or ASPxDataWebControl.DataSourceID).
ASPxPopupControl automatically creates a PopupWindow object for each record in a data source and retrieves some window characteristics from the data fields named in a specific way.
Data fields and window properties names match.
During binding, ASPxPopupControl implements its automatic binding ability by retrieving window characteristics from those data fields whose names coincide with certain property names of a PopupWindow object. The table below lists names of window object properties that can be mapped during automatic binding and also lists matching data field names you should use in a data source in order for the mapping to work.
Window properties that can be set automatically | Data field names |
---|---|
PopupWindow.ContentUrl | ContentUrl |
PopupWindow.Enabled | Enabled |
PopupWindow.Name | Name |
PopupWindow.PopupElementID | PopupElementID |
PopupWindow.ShowHeader | ShowHeader |
PopupWindow.ShowFooter | ShowFooter |
PopupWindow.Target | Target |
PopupWindow.Text | Text |
PopupWindow.ToolTip | ToolTip |
In addition to mappings, the ASPxPopupControl automatically retrieves the window header and window footer characteristics from those data fields whose names match the property names of the header and footer objects (see the table below).
Window header properties that can be set automatically | Data field names |
---|---|
PopupWindow.HeaderNavigateUrl | HeaderNavigateUrl |
PopupWindow.HeaderText | HeaderText |
PopupWindow.HeaderImage.Url | HeaderImageUrl |
PopupWindow.HeaderImage.Height | HeaderImageHeight |
PopupWindow.HeaderImage.Width | HeaderImageWidth |
Window footer properties that can be set automatically | Data field names |
---|---|
PopupWindow.FooterNavigateUrl | FooterNavigateUrl |
PopupWindow.FooterText | FooterText |
PopupWindow.FooterImage.Url | FooterImageUrl |
PopupWindow.FooterImage.Height | FooterImageHeight |
PopupWindow.FooterImage.Width | FooterImageWidth |
PopupWindow.SizeGripImageUrl | SizeGripImageUrl |
PopupWindow.SizeGripImageHeight | SizeGripImageHeight |
PopupWindow.SizeGripImageWidth | SizeGripImageWidth |
The following image illustrates the process of data retrieval during automatic binding to a particular type of a data source - XmlDataSource. Note that only the DataSourceId property is set for ASPxPopupControl.
Binding to a Site Map
Since the properties of a SiteMapNode object have specific names, ASPxPopupControl is designed to automatically bind to a Site Map source with window attributes with similar names. In the process of binding, corresponding properties of individual PopupWindow objects are automatically associated with these item attributes and mapped accordingly. See the table below for name correspondence.
Site Map node attributes | Corresponding PopupWindow object properties |
---|---|
Title | PopupWindow.Text |
Description | PopupWindow.ToolTip |
Url | PopupWindow.HeaderNavigateUrl, PopupWindow.FooterNavigateUrl |
After ASPxPopupControl detects the above-listed item attributes in the bound Site Map source, other properties are determined using conditions described in the above section.
Note
ASPxPopupControl ignores Text and ToolTip attributes if they are specified within a Site Map data source. The HeaderNavigateUrl and FooterNavigateUrl attributes redefine values of corresponding PopupWindow properties.