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

Hierarchical Grid and ShowInsertRow

7 Answers 41 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 03 Aug 2011, 01:42 PM
Hello,

i have a GridView. Sometimes I need to display in this grid a hierarchical grid. I generate this grid with the following code:
GridViewTableDefinition d = new GridViewTableDefinition();
d.Relation = new Telerik.Windows.Data.PropertyRelation(item.Name);
this.radGridView1.ChildTableDefinitions.Add(d);

Now the Child Table will be displayed but I have the annoying "Sort Column" there and I cannot add any new data into the second grid, How can I insert the "ShowInsertRow"-Button and deactivate the Sort Column in the Hierarchical Grid?

Thank you,

Martin


7 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Aug 2011, 02:05 PM
Hello Martin,

 You can define your child tables in desired way using HierarchyChildTemplate. Here is an example:
http://demos.telerik.com/silverlight/#GridView/Hierarchy/HierarchyChildTemplate

Greetings,
Vlad
the Telerik team

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

0
Martin
Top achievements
Rank 1
answered on 03 Aug 2011, 02:23 PM
Hello,

I tried that already but it does not work at all

I have the following in my XAML-Code
<telerik:RadGridView x:Name="radGridView1" AddingNewDataItem="radGridView1_AddingNewDataItem" RowEditEnded="radGridView1_RowEditEnded" AutoGenerateColumns="True" CanUserInsertRows="True" Grid.Row="4"
                     CanUserFreezeColumns="False" CanUserDeleteRows="True" ReorderColumnsMode="None"
                     ShowColumnHeaders="True" ShowGroupPanel="False" CanUserResizeColumns="True" CanUserSelect="True"
                     ShowInsertRow="True" Height="448" VerticalAlignment="Bottom">
    <telerik:RadGridView.ChildTableDefinitions>
        <telerik:GridViewTableDefinition />
    </telerik:RadGridView.ChildTableDefinitions>
     
    <telerik:RadGridView.HierarchyChildTemplate>
        <DataTemplate>
            <telerik:RadGridView x:Name="RadGridView1" CanUserFreezeColumns="False" AutoGenerateColumns="True" ShowGroupPanel="False" >
                <telerik:RadGridView.Columns>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
        </DataTemplate>
    </telerik:RadGridView.HierarchyChildTemplate>
</telerik:RadGridView>

In my Code behind I left it like it was before. Now I cannot see any data in the hierarchical grid. I cannot set the DataSource to a fixed value.

What can I do?

Thanks,

Martin














0
Vlad
Telerik team
answered on 03 Aug 2011, 02:28 PM
Hi,

 You've missed to bind your child grid - you need to assign ItemsSource. 

Regards,
Vlad
the Telerik team

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

0
Martin
Top achievements
Rank 1
answered on 03 Aug 2011, 02:29 PM
Hello Vlad,

I know. But how I can I bind the child grid from the code behind? The Itemssource differs from case to case.

Martin
0
Martin
Top achievements
Rank 1
answered on 04 Aug 2011, 07:57 AM
No solution from setting the itemssource of the child grid from the code behind? I need to archieve this....
Thanks
0
Dan
Top achievements
Rank 1
answered on 01 Dec 2011, 07:52 PM
Anyone knows how bind the child grid from the code behind yet?  For example, dgParentOrder.ItemsSource = Orders is OK but I could not specify/assign dgChildOrderDetail.ItemsSource althoght Child Grid called "dgChildOrderDetail" in xaml page.

Please advice!

-Don
0
Maya
Telerik team
answered on 02 Dec 2011, 08:29 AM
Hello Dan,

You cannot find an element defined in a data template through its Name attribute. Furthermore, as there are more than one child grids, you will have different instances of them. I would recommend you to run through our online documentation for additional information.
 

Best wishes,
Maya
the Telerik team

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

Tags
GridView
Asked by
Martin
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Martin
Top achievements
Rank 1
Dan
Top achievements
Rank 1
Maya
Telerik team
Share this question
or