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

ShowGroupPanel=False in child grid

6 Answers 104 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Orit
Top achievements
Rank 1
Orit asked on 14 Jun 2009, 09:33 AM
Hey

How can I set ShowGroupPanel=False
in a child grid (when I use hirarchy)

Thanks

6 Answers, 1 is accepted

Sort by
0
Orit
Top achievements
Rank 1
answered on 15 Jun 2009, 04:54 AM
I solved this problem
but now I have another question,
how can I control the columns of the child grid
change their header text etc.
Thanks.


by the way, this is what I used to solve my problem
 <telerik:RadGridView.HierarchyChildTemplate 

<DataTemplate>

<telerik:GridViewDataControl IsFilteringAllowed="False" ShowGroupPanel="False"/>  

</DataTemplate>

</telerik:RadGridView.HierarchyChildTemplate>

 

 

 

 

 

 

 

 

0
Rossen Hristov
Telerik team
answered on 15 Jun 2009, 09:25 AM
Hello Orit,

This is done in exactly the same way as you would do it for a normal top-level grid. In other words, if you want to configure the columns, simply add a RadGridView.Columns tag inside the child grid and do the work there. Here is a sample code snippet demonstrating that:

<Window x:Class="ManualHierarchy.Window1" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    xmlns:local="clr-namespace:ManualHierarchy" 
    Title="Window1" Height="300" Width="300"
    <Grid> 
        <telerik:RadGridView  
            x:Name="grid"  
            IsReadOnly="True" 
            AutoGenerateColumns="False" 
            ColumnsWidthMode="Fill"
             
            <telerik:RadGridView.Columns> 
                <telerik:GridViewDataColumn HeaderText="First Name" DataMemberBinding="{Binding FirstName}" /> 
                <telerik:GridViewDataColumn HeaderText="Family Name" DataMemberBinding="{Binding LastName}" /> 
            </telerik:RadGridView.Columns> 
             
            <telerik:GridViewDataControl.HierarchyChildTemplate> 
                <DataTemplate> 
                    <StackPanel DataContext="{x:Null}"
                        <telerik:RadGridView  
                            CanUserReorderColumns="False" 
                            CanUserFreezeColumns="False"  
                            ShowGroupPanel="False" 
                            ColumnsWidthMode="Auto" 
                            ItemsSource="{Binding Instruments}" 
                            Loaded="RadGridView_Loaded"
                            <telerik:RadGridView.Columns> 
                                <telerik:GridViewComboBoxColumn 
                                    HeaderText="Instruments Played" 
                                    DataMemberBinding="{Binding Path=.}" 
                                    ItemsSource="{Binding Source={local:EnumValues {x:Type local:Instrument}}}"/> 
                            </telerik:RadGridView.Columns> 
                        </telerik:RadGridView> 
                    </StackPanel> 
                </DataTemplate> 
            </telerik:GridViewDataControl.HierarchyChildTemplate> 
        </telerik:RadGridView> 
    </Grid> 
</Window> 
 

I have attached the sample project that the above code snippet is from. Please, take a look at it and let me know if you have any other questions.

Regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Orit
Top achievements
Rank 1
answered on 15 Jun 2009, 10:14 AM


private void BoundDataMainGrid()   
{  
DataSet dataSet = GetDataSet();   
RadGridView1.DataMember = dataSet.Tables["Requests"].TableName;   
RadGridView1.ItemsSource = dataSet;  
}  
 
private DataSet GetDataSet()    
{  
DataSet ds = new DataSet();   
DataTable dtParent;   
dtParent = new DataTable("Requests");   
dtParent.Columns.Add("RequestNumber");   
dtParent.Columns.Add("RequestSum");   
dtParent.Columns.Add("RequestDescription");   
dtParent.Columns.Add("RequestType");   
dtParent.Columns.Add("OrderNumber");   
dtParent.Columns.Add("OrderSum");   
dtParent.Columns.Add("Supplier");   
dtParent.Columns.Add("OrderDescription");   
dtParent.Columns.Add("RequestBalance");   
 
dtParent.Rows.Add("80710981344", "375", "‰‰™… —ˆŒ…‚ ‚Œ…Œ‰", "Ž‘‚˜š", "81250542", "375", "Žˆ˜‰—‘", "", "0");   
dtParent.Rows.Add("81210981522", "225", "€‰ˆ˜ˆ ‚Œ…Œ‰", "Ž‘‚˜š", "", "", "", "", "225");   
   
ds.Tables.Add(dtParent);  
 
DataTable dtChild;   
dtChild = new DataTable("Details");   
dtChild.Columns.Add("RequestNumber");   
dtChild.Columns.Add("Text");   
 
dtChild.Rows.Add("80710981344", "111");   
dtChild.Rows.Add("80710981344", "222");   
dtChild.Rows.Add("80710981344", "333");   
dtChild.Rows.Add("81210981522", "444");   
   
ds.Tables.Add(dtChild);  
 
ds.Relations.Add("RequestNumber", dtParent.Columns["RequestNumber"]dtChild.Columns["RequestNumber"]);   
   
return ds;   
 
}  
 
 
 

 

 

<telerik:RadGridView Margin="20,235.785,72.879,30.009" Name="RadGridView1"                                  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"   
telerik:StyleManager.Theme="Simple" AutoGenerateColumns="False"  IsFilteringAllowed="False" FlowDirection="RightToLeft" ShowGroupPanel="False" 
                                         AutoGenerateHierarchyFromDataSet="True" > 
                        <telerik:RadGridView.Columns> 
                            <telerik:GridViewDataColumn UniqueName="RequestNumber" HeaderText="מספר דרישה" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="RequestSum" HeaderText="סכום הדרישה &#13;(K ש''ח)" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="RequestDescription" HeaderText="תאור הדרישה" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="RequestType" HeaderText="סוג הדרישה" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="OrderNumber" HeaderText="מספר הזמנה" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="OrderSum" HeaderText="סכום הזמנה &#13;(K ש''ח)" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="Supplier" HeaderText="ספק" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="OrderDescription" HeaderText="תאור ההזמנה" Width="Auto" /> 
                            <telerik:GridViewDataColumn UniqueName="RequestBalance" HeaderText="יתרה בדרישה &#13;(K ש''ח)" Width="Auto" /> 
                        </telerik:RadGridView.Columns> 
                        <telerik:RadGridView.HierarchyChildTemplate> 
                              
                            <DataTemplate> 
                                <StackPanel DataContext="{x:Null}">  
                                    <telerik:RadGridView     
                            CanUserReorderColumns="False"    
                            CanUserFreezeColumns="False"     
                            ShowGroupPanel="False"    
                            ColumnsWidthMode="Auto" ItemsSource="{Binding Path=Details}" 
                            >                               
                                        <telerik:RadGridView.Columns> 
                                            <telerik:GridViewDataColumn UniqueName="RequestNumber" HeaderText="מספר דרישה" Width="Auto" /> 
                                            <telerik:GridViewDataColumn UniqueName="Text" HeaderText="תאור" Width="Auto" /> 
                                        </telerik:RadGridView.Columns> 
                                    </telerik:RadGridView> 
                                </StackPanel> 
 
                             
                            </DataTemplate> 
                              
                        </telerik:RadGridView.HierarchyChildTemplate> 
                    </telerik:RadGridView> 

 

 

 

 

 

Thank you for your answer
in this way I managed to add my specific columns
but now I dont see the values in them

what I'm tring to do is,
I hava a dataset with two tables- parent and child
and I want to show them hierachicly
(I have to set their header text by myself !)
if there is a better way to do this, I will be happy to get the code

thanks



 

 

0
Rossen Hristov
Telerik team
answered on 15 Jun 2009, 12:45 PM
Hello Orit,

This is my mistake, please accept my apologies. I have sent you XAML that is not entirely correct.

Please, remove the StackPanel's DataContext setting to null from the XAML. It should look like this:

            <telerik:RadGridView.HierarchyChildTemplate> 
                <DataTemplate> 
                    <StackPanel> 
                        <telerik:RadGridView CanUserReorderColumns="False" 
                                CanUserFreezeColumns="False" ShowGroupPanel="False" 
                                ColumnsWidthMode="Auto" ItemsSource="{Binding Path=Details}"
                            <telerik:RadGridView.Columns> 
                                <telerik:GridViewDataColumn UniqueName="RequestNumber" 
                                        HeaderText="מספר דרישה" Width="Auto"/> 
                                <telerik:GridViewDataColumn UniqueName="Text" HeaderText="תאור" 
                                        Width="Auto" /> 
                            </telerik:RadGridView.Columns> 
                        </telerik:RadGridView> 
                    </StackPanel> 
                </DataTemplate> 
            </telerik:RadGridView.HierarchyChildTemplate> 
 

I am attaching the modified source code. Once again, please excuse me for the inconvenience.

Drop me a line, if there are other problems.

Sincerely yours,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Orit
Top achievements
Rank 1
answered on 16 Jun 2009, 05:19 AM
Hi Ross
Thanks fot your reply.

I used your code,
I can see that it changes the properties of the all child grid
like 
IsFilteringAllowed="False"    
ShowGroupPanel="False" etc.  
 
 

but there is no change in the columns
not on the headerText, nothing
it shows the two columns that I have in the dataTable
even if I drop them from the   

RadGridView.Columns

any idea??

 

 

 

 

0
Accepted
Rossen Hristov
Telerik team
answered on 16 Jun 2009, 01:08 PM
Hello Orit,

Now I see what you mean. Sorry for the misunderstanding.

Unfortunately, the scenario that you are describing is currently not available out of the box. However, we have gone the extra mile and "hacked" the grid to achieve the scenario that you are describing. Have in mind that what we have done is not very intuitive and this is not the way things should be done in general. Hopefully the new Q2 release will introduce an entirely new data engine and all of the "hacks" we have done will not be necessary anymore.

I have attached the modified project and placed code comments to explain what we have done. Please, let us know if you don't understand something or if you would like to ask us something else.

Regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
Orit
Top achievements
Rank 1
Answers by
Orit
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or