Try OpenEdge Now
skip to main content
GUI for .NET Primer
Data Binding : Binding to a .NET control
 

Binding to a .NET control

From a UI standpoint, data binding is an integration between UI components (controls) and data sources. As such, data binding establishes the connection between the ABL data source, which can be a ProDataSet, a query on a database table or temp-table, or a buffer, and the .NET UI component. Examples of tight data binding in ABL include:
*Queries and browses
*Formats applied to UI widgets
*Code to display data
*Code to update data
*Statements that handle data transfer
For bound controls, data is supplied to the control by the binding source. The binding source interface provides methods and properties that a bound control can access and it also provides events to notify a bound control. Think of a binding source as a view to your data.
A critical component of a GUI for .NET application is the ability to access and update ABL data from the UI. .NET defines an API that all bound controls use to obtain their data. The OpenEdge data binding Progress.Data.BindingSource class (referred to as the ProBindingSource) is an OpenEdge .NET class used by .NET controls to access ABL data. This component, which is available in the Visual Designer Toolbox, is the best mechanism for binding your ABL data to your user interface.
The ProBindingSource is a non-visual component that is used at design time and run time. Once placed on a form, it is made available to all .NET controls as a data source. A binding source can be shared by multiple controls.
The following figure is a graphical representation of where the ProBindingSource fits between the .NET control and the data source, in this case a ProDataSet. UI controls are bound to the ProBindingSource which acts as a data source (#1). The ProBindingSource exposes an API to .NET controls to access the data.
At run time the ProBindingSource is then bound to a buffer, a query, or a ProDataSet (#2). The ProBindingSource spans the bridge (#3) between the OpenEdge AVM and the .NET CLR to pass data to the UI control and back again.
Figure 3. .NET-ABL Data Binding Model
The ProBindingSource provides ABL data-centric behavior to .NET controls, including the common behaviors of Creating, Reading, Updating, and Deleting data records (CRUD). Key benefits of using the ProDataSet as a data source for a ProBindingSource include:
*Automatic data synchronization
*Updating
*Batching
*Currency
A currency manager is built-in, controlling the position of the record cursor. This is in comparison to .NET, in which data source and currency management are handled separately.
Note: Data binding is not limited to visual objects. For example, the Ultra Controls scheduling controls can be data bound using an intermediary control, which then provides data to the visual objects.