This is a migrated thread and some comments may be shown as answers.

How to show Master -> Detail with hierarchy

7 Answers 190 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Lynne
Top achievements
Rank 1
Lynne asked on 02 Nov 2011, 08:26 PM
I thought I'd had this working a couple months ago, but apparently not.  Here's the situation.  I have a Master-Detail situation similar to a Customers->Orders->Line Items.

I'd like to use two grids to display information regarding Customers and related information.  On the left I have a RadGridView showing all my Customers.  On the right, I have a grid that I'd like to use to display the detail information using hierarchical grids.  In the Customers grid I'd select a row, and in the Details grid I'd see the records associated with a single customer:

<selected Customer>|    |<Selected Customer add'l details>
Customer 2         |    |  <Order 1>
Customer n         |    |    <Line Item 1>
                   |    |    <Line Item n>
                   |    |  <Order 2>
                   |    |    <Line Item 1>
                   |    |    <Line Item n>


                         The left-hand grid is fine, for the life of me I can't get anything to display in the right-hand grid.  I do have a standalone hierarchical grid that shows everything ok, so presumably I'm doing something wrong with the ItemsSource/Binding/... in the right-hand grid.  If it makes a difference, the data is all in CollectionViewSources using Entity Framework data.  

I've gone through the examples and haven't found anything that's helped me with this particular situation.  Do you have any examples or suggestions?

Thanks very much.

7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Nov 2011, 07:51 AM
Hi,

 Have you tried to bind the second grid ItemsSource to your first grid SelectedItem child data? 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Lynne
Top achievements
Rank 1
answered on 03 Nov 2011, 02:29 PM
Yes, I have, and nothing shows up.  Do you have an example of a Master->Detail that uses a hierarchical grid for the Detail grid?

0
Vlad
Telerik team
answered on 03 Nov 2011, 02:35 PM
Hello,

 Can you post the binding you've tried?

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Lynne
Top achievements
Rank 1
answered on 03 Nov 2011, 06:58 PM
Unfortunately I'm under a great deal of pressure to get this working, so I've reverted to a single hierarchical grid and don't have the prior code.  IIRC, I set the ItemsSource of the hierarchical (detail) grid to the element (Master grid) - CurrentItem.

Since my detail grid needs to show the Customer selected in the Master grid, perhaps I'm doing this wrong.  Perhaps I should just apply a filter to the Detail grid so it only shows the item that matches the item selected in the Master?
0
Lynne
Top achievements
Rank 1
answered on 04 Nov 2011, 05:49 AM
My Master Grid, bound to a CollectionViewSource, and which displays correctly

<telerik:RadGridView Name="gridActiveMatch"
                     ItemsSource="{Binding Source={StaticResource cviewMatches}}" />

My Detail grid, which doesn't display anything

<telerik:RadGridView
                 ItemsSource="{Binding ElementName=gridActiveMatch, Path=CurrentItem}"
                     Name="matchesRadGridView"/>



0
Accepted
Vlad
Telerik team
answered on 08 Nov 2011, 08:37 AM
Hi,

 If your source is not ICollectionView you will need to set IsSynchronizedWithCurrentItem to True. I've attached an example project for reference. 

Best wishes,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Lynne
Top achievements
Rank 1
answered on 08 Nov 2011, 07:17 PM
Thanks, but I'd already determined that and come up with a workable solution.
Tags
GridView
Asked by
Lynne
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Lynne
Top achievements
Rank 1
Share this question
or