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
You can define your child tables in desired way using HierarchyChildTemplate. Here is an example:
http://demos.telerik.com/silverlight/#GridView/Hierarchy/HierarchyChildTemplate
Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
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
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 >>
I know. But how I can I bind the child grid from the code behind? The Itemssource differs from case to case.
Martin
Thanks
Please advice!
-Don
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.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>