Binding to Data

  • 3 minutes to read

A PopupControl can be populated with information taken from a data source, which can be any object that implements the IListSource, IEnumerable or IDataSource interface (e.g. SqlDataSource, XmlDataSource).

The MVC Popup Extension provides the following data binding methods:

Automatic Data Binding

The MVC Popup Extension has a built-in ability to automatically retrieve data from a data source. PopupControl creates an MVCxPopupWindow object for each record in a data source and retrieves window characteristics from those data fields whose names coincide with certain property names of the MVCxPopupWindow 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 (via MVCxPopupControl.ContentUrl) ContentUrl
PopupWindow.Enabled (via MVCxPopupControl.Enabled) Enabled
PopupWindow.Name (via MVCxPopupControl.Name) Name
PopupWindow.PopupElementID (via MVCxPopupControl.PopupElementID) PopupElementID
PopupWindow.ShowHeader (via MVCxPopupControl.ShowHeader) ShowHeader
PopupWindow.ShowFooter (via MVCxPopupControl.ShowFooter) ShowFooter
PopupWindow.Target (via MVCxPopupControl.Target) Target
PopupWindow.Text (via MVCxPopupControl.Text) Text
PopupWindow.ToolTip (via MVCxPopupControl.ToolTip) ToolTip

Additionally to window properties mapping, PopupControl possesses the ability to retrieve some window header and window footer characteristics from data fields named in a specific way.

Window header properties that can be set automatically Data field names
PopupWindow.HeaderNavigateUrl (via MVCxPopupControl.HeaderNavigateUrl) HeaderNavigateUrl
PopupWindow.HeaderText (via MVCxPopupControl.HeaderText) HeaderText
ImagePropertiesBase.Url (via MVCxPopupControl.HeaderImage.Url) HeaderImageUrl
ImagePropertiesBase.Height (via MVCxPopupControl.HeaderImage.Height) HeaderImageHeight
ImagePropertiesBase.Width (via MVCxPopupControl.HeaderImage.Width) HeaderImageWidth
Window footer properties that can be set automatically Data field names
PopupWindow.FooterNavigateUrl (via MVCxPopupControl.FooterNavigateUrl) FooterNavigateUrl
PopupWindow.FooterText (via MVCxPopupControl.FooterText) FooterText
ImagePropertiesBase.Url (via MVCxPopupControl.FooterImage.Url) FooterImageUrl
ImagePropertiesBase.Height (via MVCxPopupControl.FooterImage.Height) FooterImageHeight
ImagePropertiesBase.Width (via MVCxPopupControl.FooterImage.Width) FooterImageWidth
ImagePropertiesBase.Url (via MVCxPopupControl.SizeGripImage.Url) SizeGripImageUrl
ImagePropertiesBase.Height (via MVCxPopupControl.SizeGripImage.Height) SizeGripImageHeight
ImagePropertiesBase.Width (via MVCxPopupControl.SizeGripImage.Width) SizeGripImageWidth

Since the properties of a SiteMapNode object have specific names, PopupControl 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 MVCxPopupWindow 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 (via MVCxPopupControl.Text)

Description

PopupWindow.ToolTip (via MVCxPopupControl.ToolTip)

Url

PopupWindow.HeaderNavigateUrl (via MVCxPopupControl.HeaderNavigateUrl),

PopupWindow.FooterNavigateUrl (via MVCxPopupControl.FooterNavigateUrl)

The structure of a Site Map allows flexibility in the naming of item attributes. After PopupControl detects the above-listed item attributes in the bound Site Map source, other properties are determined using conditions described in the above section.

NOTE

PopupControl 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.

Online demos