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

Multiple child grids in the grid

3 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pramod
Top achievements
Rank 1
Pramod asked on 02 Apr 2013, 05:14 PM
Hi
I am currently trying to show two child grids when the user expands the parent row. These two child grids are not related to each other and they are not nested.

Here is an example of the data.
objectA
-- List<ObjectB>
--List<ObjectC>

Parent Grid Shows all the rows for ObjectA => when the user expands the parent row if eityher listA or ListB has any items int he collection.

Currently I have a grid which has one Child grid which works Successfully.
Question : Can I use multiple Child table definitions . Or is there a bettre way to solve this situation
<telerik:RadGridView
                            x:Name="ListAGridView"
                            Margin="5,5,5,5"
                            MinHeight="100"
                            MaxHeight="200"
                            IsReadOnly="True"
                            SelectionMode="Extended"
                            AutoGenerateColumns="False"
                            ShowGroupPanel="False"
                            RowIndicatorVisibility="Collapsed"
                            SelectionChanged="UsageGridView_SelectionChanged"
                            ItemsSource="{Binding Path=Usages, Mode=OneWay}"
                            SelectedItem="{Binding Path=SelectedUsage, Mode=TwoWay}"
                            HierarchyChildTemplate="{StaticResource UsagesChildTemplate}"
                            >
 <i:Interaction.Behaviors>
                                <Behaviors:RadGridRowExpandableBehavior IsExpandableSourcePropertyName="ListB.Count" />
                            </i:Interaction.Behaviors>
 
<telerik:RadGridView.ChildTableDefinitions>
                                <telerik:GridViewTableDefinition>
                                    <telerik:GridViewTableDefinition.Relation>
                                        <Data:PropertyRelation ParentPropertyName="ListB" />
                                    </telerik:GridViewTableDefinition.Relation>
                                </telerik:GridViewTableDefinition>
..../>

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 03 Apr 2013, 12:43 PM
Hello,

Y
ou can define different RowDetailsTemplates and show the one you prefer at a time using a RowDetailsTemplateSelector. An example with it is available on this online demo.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Pramod
Top achievements
Rank 1
answered on 03 Apr 2013, 01:02 PM
Hi Didie
I don't want to select between the two grids I want to show both based upon the items in the collection. and if the collection is empty I don't want the child grid to show up. any hel in this regards is appreciated.

Thank you
0
Accepted
Dimitrina
Telerik team
answered on 03 Apr 2013, 02:23 PM
Hello,

You can check this online demo on how to hide the expand hierarchy button when there is no data to be shown. Please note that you should inform the GridView what to show in the template you define for its details/hierarchy. Just define both the child GridViews in one template and set it for the GridView' details/hierarchy.

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Pramod
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Pramod
Top achievements
Rank 1
Share this question
or