We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Master-Details Relation in SfDataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

142301 Jan 25,2019 08:32 PM UTC Feb 1,2019 05:08 AM UTC WinForms 7
loading
Tags: SfDataGrid
Alfred Klein
Asked On January 25, 2019 08:32 PM UTC


Hi.

I'm new to Syncfusion Tools and looking for a DataGrid to show Master-Detail relations.
I've found it in the GridDataBoundGrid component -  https://help.syncfusion.com/windowsforms/databoundgrid/using-master-details-relation
That's what I need.

But it looks like this control is "classic" and one should better use the SfDataGrid when starting new projects.
In SfDataGrid I could only find "nested detail grids".
So my question is: does SfDataGrid also support the way of showing Master-Detail-Relations like the GridDataBoundGrid?

Thanks

Jayaleshwari N [Syncfusion]
Replied On January 28, 2019 11:12 AM UTC

Hi Alfred, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked the reported query “Master-Details Relation in SfDataGrid” from our side. SfDataGrid provided support to show Master-Details relations as per your requirement. You can refer the following user guide documentation to use the Master-Details View in SfDataGrid. 
 
 
We have prepared the sample with master details view in SfDataGrid for your reference and you can download the same from the following location. 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N 


Alfred Klein
Replied On January 28, 2019 07:50 PM UTC

Hi Jayaleshwari

thank you for your assistance.
I've tried your example which shows the following result like the screen shot - the Detail-grid is nested in the Master-grind:


But what I want do achieve is to place the Detail-grid in a separate panel beneath the Master-grid.
Screenshot:
With this approach I will be able to design a screen with
- one master-grid in the top-panel. For example:  customer
- two or more detail-grids of the customer in the bottom-panel in tabsheets.
   For example:  customer-orders in tab1, customer-contact-persons in tab2, customer-mailing-list in tab3, ...

Is there any way to achieve this with SfDatagrind

Thanks again
Alfred



Mohanram Anbukkarasu [Syncfusion]
Replied On January 29, 2019 02:01 PM UTC

Hi Alfred, 

Thanks for your update.  

SfDataGrid doesn’t have direct support to display master and details view in separate panels and tab pages as per your requirement. However we have a workaround to achieve this by using separate SfDataGrid controls for master and the details view and the TabControl to hold the child DataGrid. The DataSource for the child DataGrid can be changed when selection is changed in the parent DataGrid by using the SfDataGrid.SelectionChanged event. Please refer the following code example. 

Code example :  

parentDataGrid.SelectionChanged += parentDataGrid_SelectionChanged; 

void parentDataGrid_SelectionChanged(object sender, Syncfusion.WinForms.DataGrid.Events.SelectionChangedEventArgs e) 
{ 
    var data = this.parentDataGrid.SelectedItem as OrderInfo; 
    this.childDataGrid.DataSource = data.OrderDetails; 
} 

We have prepared a simple sample with single details grid for your reference and it is available in the following link. 


If your sample have two or more details grid, you need to add separate TabPage and SfDataGrid for each details grid. Currenty we are analyzing the feasibility to achieve this behavior generically based on the number of details grid. We will update you with further details on January 30, 2019. 
 
Regards, 
Mohanram A. 


Alfred Klein
Replied On January 29, 2019 06:40 PM UTC

Hi Mohanram,

thank you for working on my thread.

Your example-solution is exactly what I was looking for.
Thank you for your help!

Best regards
Alfred

Jayaleshwari N [Syncfusion]
Replied On January 30, 2019 12:28 PM UTC

Hi Alfred, 
 
Thanks for the update. 
 
We have modified the sample generically based on the property info and created child data grids. We have attached the sample for your reference and you  can download the same from the following location. 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 


Alfred Klein
Replied On January 31, 2019 07:43 PM UTC

Hi Jayaleshwari

thank you for that new example. It is a very interesting approach.

At the moment I don't need more help.

Thanks again and best regards

Alfred

Jayaleshwari N [Syncfusion]
Replied On February 1, 2019 05:08 AM UTC

Hi Alfred, 
 
Thanks for the update. Please get in touch if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;