Hello
I have hierarchy with 3 levels
father-child-subChild.
according to my data-
the father rows will always have children
but not all the child rows will have subChildRows
so I need to be able to hide the expand button in the childGrid
I saw your example of:
I have hierarchy with 3 levels
father-child-subChild.
according to my data-
the father rows will always have children
but not all the child rows will have subChildRows
so I need to be able to hide the expand button in the childGrid
I saw your example of:
this
.MasterTableDefinition_PreviewDataRowCreate
but how or where can I add this method to my childGrid
Thanks!
Orit
10 Answers, 1 is accepted
0
Hi Orit,
You will need to manually define the HierarchyChildTemplate of the father grid, place the child grid inside it and attach to its PreviewDataRecordCreate event. I hope this helps.
Sincerely yours,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You will need to manually define the HierarchyChildTemplate of the father grid, place the child grid inside it and attach to its PreviewDataRecordCreate event. I hope this helps.
Sincerely yours,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Orit
Top achievements
Rank 1
answered on 09 Sep 2009, 09:58 AM
There is no
Thanks
PreviewDataRecordCreate property in my HierarchyChildTemplate
<telerik:RadGridView Name="gvAccount" Margin="2,2,2,2" |
CanUserReorderColumns="False" ColumnsWidthMode="Fill" HorizontalContentAlignment="Right" |
CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" CanUserSortColumns="False" |
FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="True" CanUserInsertRows="False"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="BudgetTypeName" Header="תקציב" Width="60"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון/ סעיף/תת סעיף" Width="160" CellStyle="{StaticResource ToolTipColumnStyle}"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מס' חשבון/ סעיף/תת סעיף" Width="110" /> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="TotalBudget" Header="הקצבה כוללת (אש''ח)" Width="75"/> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="BalanceBudgetAllocation" Header="יתרה לתקצוב (אש''ח)" Width="75" /> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumBudgetRequest" Header="שריון לפעילויות (אש''ח)" Width="75"/> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumOrderAllocation" Header="התחייבות לפעילויות (אש''ח)" Width="75" /> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="SumOrderPaid" Header="שולם בפועל (אש''ח)" Width="75"/> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="BalanceToPay" Header="יתרה לתשלום (אש''ח)" Width="75"/> |
<telerik:GridViewDataColumn IsReadOnly="True" DataFormatString="{}{0:#,##0.00₪}" UniqueName="ActivityTypeName" Header="סוג פעילות" Width="130"/> |
</telerik:RadGridView.Columns> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<telerik:RadGridView Name="gvBudget" Loaded="OnChildGridLoaded" |
CanUserReorderColumns="False" ColumnsWidthMode="Fill" HorizontalContentAlignment="Right" |
CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" |
FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="False" ClipToBounds="True" CellEditEnded="gvBudget_CellEditEnded"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="aa" Header="סוג תקציב" Width="33"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון" Width="160" CellStyle="{StaticResource ToolTipColumnStyle}"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מספר חשבון" Width="110"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="TotalBudget" Header="הקצבה כוללת אש''ח" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="BalanceBudgetAllocation" Header="יתרה לתקצוב אש''ח" Width="75" /> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumBudgetRequest" Header="שריון לפעילות אש''ח" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumOrderAllocation" Header="התחיבות לפעילות אש''ח" Width="75" /> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumOrderPaid" Header="שולם בפועל" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="BalanceToPay" Header="יתרה לתשלום" Width="75"/> |
<telerik:GridViewComboBoxColumn UniqueName="ActivityTypeID" DataMemberBinding="{Binding ActivityTypeID}" DisplayMemberPath="Name" SelectedValueMemberPath="Id" Header="סוג פעילות" Width="130" /> |
</telerik:RadGridView.Columns> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<telerik:RadGridView Name="gvSubBudget" Loaded="OnSubChildGridLoaded" CellEditEnded="gvBudget_CellEditEnded" |
CanUserReorderColumns="False" ColumnsWidthMode="Fill" HorizontalContentAlignment="Right" |
CanUserFreezeColumns="False" ShowGroupPanel="False" AutoGenerateColumns="False" |
FlowDirection="RightToLeft" IsFilteringAllowed="False" ShowColumnHeaders="False" ClipToBounds="True"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="aa" Header="סוג תקציב" Width="32"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Name" Header="שם חשבון" Width="160" CellStyle="{StaticResource ToolTipColumnStyle}"/> |
<telerik:GridViewDataColumn IsReadOnly="True" UniqueName="Number" Header="מספר חשבון" Width="110"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="TotalBudget" Header="הקצבה כוללת אש''ח" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="BalanceBudgetAllocation" Header="יתרה לתקצוב אש''ח" Width="75" /> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumBudgetRequest" Header="שריון לפעילות אש''ח" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumOrderAllocation" Header="התחיבות לפעילות אש''ח" Width="75" /> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="SumOrderPaid" Header="שולם בפועל" Width="75"/> |
<telerik:GridViewDataColumn DataFormatString="{}{0:#,##0.00₪}" IsReadOnly="True" UniqueName="BalanceToPay" Header="יתרה לתשלום" Width="75"/> |
<telerik:GridViewComboBoxColumn UniqueName="ActivityTypeID" DataMemberBinding="{Binding ActivityTypeID}" DisplayMemberPath="Name" SelectedValueMemberPath="Id" Header="סוג פעילות" Width="130"/> |
</telerik:RadGridView.Columns> |
</telerik:RadGridView> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
0
Hi Orit,
Please, excuse me I made a mistake. You should attach to the child table definition's event. Something like this (If you have 3-level hierarchy with Clubs -> Players -> Games):
I hope this helps.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Please, excuse me I made a mistake. You should attach to the child table definition's event. Something like this (If you have 3-level hierarchy with Clubs -> Players -> Games):
public MainPage() |
{ |
InitializeComponent(); |
GridViewTableDefinition playersTableDefinition = new GridViewTableDefinition(); |
playersTableDefinition.Relation = new PropertyRelation("Players"); |
this.clubsGrid.TableDefinition.ChildTableDefinitions.Add(playersTableDefinition); |
GridViewTableDefinition gamesTableDefinition = new GridViewTableDefinition(); |
gamesTableDefinition.Relation = new PropertyRelation("Games"); |
playersTableDefinition.ChildTableDefinitions.Add(gamesTableDefinition); |
playersTableDefinition.PreviewDataRecordCreate += new System.EventHandler<DataRecordCreateEventArgs>(playersTableDefinition_PreviewDataRecordCreate); |
this.clubsGrid.ItemsSource = Club.GetClubs(); |
} |
void playersTableDefinition_PreviewDataRecordCreate(object sender, DataRecordCreateEventArgs e) |
{ |
} |
I hope this helps.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Orit
Top achievements
Rank 1
answered on 09 Sep 2009, 11:27 AM
Hi
I try to use your code
but the "playersTableDefinition_PreviewDataRecordCreate" dose not happen
Thanks
I try to use your code
but the "playersTableDefinition_PreviewDataRecordCreate" dose not happen
Thanks
0
Orit
Top achievements
Rank 1
answered on 10 Sep 2009, 07:39 AM
Can you please answer me?
I use your code but when I click on the expand button
nothing happens
Thanks
Orit
I use your code but when I click on the expand button
nothing happens
Thanks
Orit
0
Hello Orit,
I have prepared a small sample project and attached it. Please not that you should get the binaries from our Latest Internal Build and everything should work as expected.
Here is part of the code:
Please, let us know if the problem still exists after you upgrade to the Latest Internal Build binaries.
Kind regards,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I have prepared a small sample project and attached it. Please not that you should get the binaries from our Latest Internal Build and everything should work as expected.
Here is part of the code:
using System.Windows.Controls; |
using Telerik.Windows.Controls; |
using Telerik.Windows.Data; |
namespace TicketID_234244_NestedHierarchyChildTemplates |
{ |
public partial class MainPage : UserControl |
{ |
public MainPage() |
{ |
InitializeComponent(); |
GridViewTableDefinition playersTableDefinition = new GridViewTableDefinition(); |
playersTableDefinition.PreviewDataRecordCreate += OnPlayersTableDefinitionPreviewDataRecordCreate; |
playersTableDefinition.Relation = new PropertyRelation("Players"); |
this.clubsGrid.TableDefinition.ChildTableDefinitions.Add(playersTableDefinition); |
GridViewTableDefinition gamesTableDefinition = new GridViewTableDefinition(); |
gamesTableDefinition.Relation = new PropertyRelation("Games"); |
playersTableDefinition.ChildTableDefinitions.Add(gamesTableDefinition); |
this.clubsGrid.ItemsSource = Club.GetClubs(); |
} |
static void OnPlayersTableDefinitionPreviewDataRecordCreate(object sender, DataRecordCreateEventArgs e) |
{ |
Player player = (Player)e.Data; |
e.IsExpandableRecord = player.Games.Count > 0; |
} |
} |
} |
<UserControl x:Class="TicketID_234244_NestedHierarchyChildTemplates.MainPage" |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.GridView" |
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"> |
<Grid> |
<telerik:RadGridView Name="clubsGrid" |
AutoGenerateColumns="False" |
ColumnsWidthMode="Auto"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn |
Header="Name" |
DataMemberBinding="{Binding Name}"/> |
<telerik:GridViewDataColumn |
Header="Est." |
DataMemberBinding="{Binding Established}" |
DataFormatString="{}{0:yyyy}"/> |
<telerik:GridViewDataColumn |
Header="Stadium" |
DataMemberBinding="{Binding StadiumCapacity}" |
DataFormatString="{}{0:N0}"/> |
</telerik:RadGridView.Columns> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<telerik:RadGridView |
Name="playersGrid" |
ShowGroupPanel="False" |
AutoGenerateColumns="False" |
ColumnsWidthMode="Auto"> |
<telerik:RadGridView.Columns> |
<telerik:GridViewDataColumn |
Header="Name" |
DataMemberBinding="{Binding Name}"/> |
<telerik:GridViewDataColumn |
Header="Number" |
DataMemberBinding="{Binding Number}"/> |
<telerik:GridViewDataColumn |
Header="Position" |
DataMemberBinding="{Binding Position}"/> |
<telerik:GridViewDataColumn |
Header="Country" |
DataMemberBinding="{Binding Country}"/> |
</telerik:RadGridView.Columns> |
<telerik:RadGridView.HierarchyChildTemplate> |
<DataTemplate> |
<telerik:RadGridView |
Name="gamesGrid" |
ShowGroupPanel="False" |
ColumnsWidthMode="Auto"> |
</telerik:RadGridView> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
</DataTemplate> |
</telerik:RadGridView.HierarchyChildTemplate> |
</telerik:RadGridView> |
</Grid> |
</UserControl> |
Please, let us know if the problem still exists after you upgrade to the Latest Internal Build binaries.
Kind regards,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Orit
Top achievements
Rank 1
answered on 10 Sep 2009, 09:26 AM
I set the ItemsSource of my father grid
to be a dataSet with 3 dataTables
Account-Budget-SubBudget
and with Relations:
dsAccount.Relations.Add("BudgetRelation", |
dsAccount.Tables["Account"].Columns["Number"], |
dsAccount.Tables["Budget"].Columns["ParentID"]); |
dsAccount.Relations.Add("SubBudgetRelation", |
dsAccount.Tables["Budget"].Columns["Number"], |
dsAccount.Tables["SubBudget"].Columns["ParentID"]); |
return dsAccount; |
GridViewTableDefinition playersTableDefinition = new GridViewTableDefinition(); |
playersTableDefinition.PreviewDataRecordCreate += OnPlayersTableDefinitionPreviewDataRecordCreate; |
playersTableDefinition.Relation = new PropertyRelation("Budget"); |
this.gvAccount.TableDefinition.ChildTableDefinitions.Add(playersTableDefinition); |
GridViewTableDefinition gamesTableDefinition = new GridViewTableDefinition(); |
gamesTableDefinition.Relation = new PropertyRelation("SubBudget"); |
playersTableDefinition.ChildTableDefinitions.Add(gamesTableDefinition); |
when I try to use it
when I click the expand button-
1. the OnPlayersTableDefinitionPreviewDataRecordCreate does not raise!
2. I see a black row- like an empty grid
and a normal grid with the expected data
if I remove the relation from my dataSet
I see only empty grid
any idea??
Thanks!
0
Hi Orit,
Can you please send us your project. Thanks.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Can you please send us your project. Thanks.
All the best,
Ross
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Orit
Top achievements
Rank 1
answered on 10 Sep 2009, 10:12 AM
How can I attach files?
0
Hi Orit,
You can open support ticket.
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
You can open support ticket.
Sincerely yours,
Vlad
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.