i am using RadGridView with multi child table definitions. child rows are bounded twice.The child rows first bounded under the parent row and again bounded with the grid(with the parent row ).
if i have a record under parent , i don't want to display the same record as another one.
please see the attatched file or (http://demos.telerik.com/silverlight/#GridView/Hierarchy/SelfReference).
Thanks In Advance.
3 Answers, 1 is accepted
If you examine the source code for the demo, you will see that the self-referencing hierarchy fills the child tables with all the records from the parent grid that satisfy a certain condition - in this case it is Child.ReportsTo == Parent.EmployeeId. The Nancy Davolio object's ReportsTo property equals 2, which is the EmployeeId of Andrew Fuller, the second object, and that is why the Nancy Davolio object appears in both the parent and child grids. In short, this is a trait of the self-referencing hierarchy approach. Perhaps you would like to use another type of hierarchy relationship if this behavior does not satisfy you.
Greetings,
Yavor Georgiev
the Telerik team
Hi Yavor Georgiev,
In the selfreference hierarchical grid, we have parent and child. We should show child row inside the parent Row. But now child is displayed inside Parent Row and also shown as parent row. Please let us know how we can show only the child inside the parent and not to show child as parent.
please see Attatched File (img 1). it displayed like this .
I have created below code in RowLoaded to disable parent record ,if it is present in child table.
Boolean blnRow = false;
Boolean blnDisable = true;
GridViewRow row;
Grid_RowDetails grdRowDetails;
try
{
row = e.Row as GridViewRow;
grdRowDetails = e.Row.DataContext as Grid_RowDetails;
vw_ProjectDet objTable = (vw_ProjectDet)e.Row.DataContext;
intProject = objTable.pt_ProjectID;
blnRow = HasSubordinates(intProject );
blnDisable = HasParentTask(intProject );
if (blnDisable == true)
{
row.Visibility = System.Windows.Visibility.Collapsed;
row.Height = 0;
}
}
after execute the method , the grid display like ( please see attatched file img 2).
please let me know ,How to fix it.
Thanks In Advance,
Warm Regards,
kannan.s
You cannot use RowLoaded to modify visibility-related properties of the row - this event was never intended to be used in this way, as it breaks virtualization. The problem you are experiencing is because of the type of hierarchy you're trying to use. The whole point of self-referencing hierarchies is that records in the child tables actually come from the parent table, but only have some logical relationships which dictate which record is a child and which is a parent.
Perhaps you need to use another type of hierarchy, more well-suited to your scenario. You can read about the hierarchical capabilities of RadGridView in our online documentation here, and you can check out our hierarchy demos here.
Greetings,
Yavor Georgiev
the Telerik team