Use the .NET DataMember property
- Last Updated: January 17, 2024
- 2 minute read
- OpenEdge
- Version 12.8
- Documentation
In general, when you want to display child records in a separate control from the parent record, you create multiple ProBindingSources. You bind one ProBindingSource to the parent table's navigation query and bind a different ProBindingSource to each child's relation query, as shown below:
|
However, you can use a single ProBindingSource
for a ProDataSet and still display the child records in a separate
control. After binding the ProBindingSource to the ProDataSet, you
can set each control's DataMember property to point
to the appropriate table, as shown below:
|
In the example above, the ProBindingSource binds
to a hierarchical set of tables starting at the top-level table, ttCustomer.
The Customer grid binds to the ProBindingSource. Because the top-level
table in the ProBindingSource is automatically assumed, the code
does not need to specify the grid's DataMember.
However, the code specifies the Order grid's DataMember as ttOrder,
so that grid binds to the orders for the current customer. Similarly,
the code specifies the OrderLine grid's DataMember as ttOrder.ttOrderLine,
so that grid binds to the order lines for the current order.
Notice
that in order to set the DataMember property, you
must specify the full hierarchy of child tables. Also, when you
are interested in the parent records, you do not set the DataMember property,
since the ProBindingSource already binds directly to the top-level
table.
DataMember property a little differently than
other .NET implementations. You can set the DataMember property to
the top-level table in .NET, but not in ABL.Similarly,
you can use a control's DataMember property to
bind to a single field within a ProBindingSource bound to a ProDataSet, as
shown below:
|
For a field in the top-level table, you can omit the table name, as shown below:
|