Description:
I have a master-detail grid and want to display the detail data of the currently focused master row within another data-bound control. For example, I want to display detail data within a vertical grid. The current vertical grid record should be synchronized with the currently focused row within the Grid's detail view. How to do this?
Answer:
When a master-detail relation is used and the detail BindingContext is the same for all details, its detail list is automatically destroyed when you navigate from one master record to another within the master binding context. In this case it's impossible to display several master rows as expanded at the same time. To avoid this problem we use different BindingContexts for different details. This makes it impossible to perform synchronization of another control which is bound to the same detail relation. However, you can avoid this problem by handling the MasterGridView's ColumnView.FocusedRowChanged event. Within this event you can obtain the detail view's data source and bind any another control (e.g. the VerticalGrid) to the same data source. Additionally, you will need to handle the detailView's BaseView.DataSourceChanged event within which you should refresh the second control's data source for the first time when a certain detail view clone has been created.
In the How to synchronize a data bound control with a detail grid view example you will find a sample project which demonstrates the approach described above.
See Also:
How to Display Master-Detail Tables in Separate Grid Controls
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.