Bind Report Controls to Data (Legacy Data Bindings)
- 2 minutes to read
Bind Report Controls at Design Time
After connecting a report to data, the Field List panel displays the data source's hierarchy and provides access to the available data fields. This panel allows you to bind report controls to data in all binding modes.
Dropping a data field onto a report's surface creates a new report control bound to the corresponding field.
Dropping a data field onto an existing control binds this control to the corresponding field.
See the Field List document for more information about using this panel for data binding.
Note that while binding, the field is assigned to the control's property with the DefaultBindableProperty attribute (usually, XRControl.Text).
You can also bind a control to the calculated fields and report parameters, and combine static and dynamic content in the same control (for instance, to append a text prefix or postfix to a value obtained from a database).
The set of bindable properties differs depending on the control type. The Properties grid's Data Bindings group provides access to these properties. Choose the property you want to bind and select the required data field in the drop-down list.
You can click the control's smart tag and bind the most popular binding properties to data. Invoke the Data Binding option's drop-down list and select the field.
To unbind a control's property, invoke the binding drop-down list and select None.
Bind Report Controls at Runtime
The XRControl.DataBindings collection stores all control bindings (XRBinding objects). You can bind a control to a data field at runtime by creating an XRBinding object with the appropriate settings and add it to the collection (for instance, using the XRBindingCollection.Add method).
The following code snippet illustrates how to bind a label control to the Categories table's CategoryName data field: