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

[Solved] Self-referencing gridview

2 Answers 111 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mahmut
Top achievements
Rank 2
Mahmut asked on 27 Jul 2011, 12:17 PM

 

Hi,
I have a table with hierarchical structure (table fields: CustomerGuid(rowguid),....,ParentGuid(nullable)).
I'm trying to use self-referencing gridview to show this data by using the xaml lines below.

<telerik:RadGridView.ChildTableDefinitions> 

<telerik:GridViewTableDefinition>

<telerik:GridViewTableDefinition.Relation>

<telerikData:TableRelation IsSelfReference="True">

 <telerikData:TableRelation.FieldNames>

<telerikData:FieldDescriptorNamePair

ParentFieldDescriptorName="CustomerGuid" 

ChildFieldDescriptorName="ParentGuid"/>  

</telerikData:TableRelation.FieldNames>  

</telerikData:TableRelation>  

</telerik:GridViewTableDefinition.Relation>  

</telerik:GridViewTableDefinition>  

</telerik:RadGridView.ChildTableDefinitions>

This pattern works well. But I want rows (or entities) with ParentGuid to be shown only in child table (not more than once). Is it possible?
Thanks in advance...

 

 

 

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 28 Jul 2011, 11:42 AM
Hello Mahmut,

You can easily prevent such rows(with ParentID != 0) from appearing on the root level by creating a filter descriptor which would only allow rows with ParentID equal to 0.

Copy Code
<controls:RadGridView.FilterDescriptors>
     <data:FilterDescriptor Member="ParentID" Operator="IsEqualTo"Value="0"/>                       
</controls:RadGridView.FilterDescriptors>

May you please refer to this forum thread on the same topic?

Greetings,
Didie
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Mahmut
Top achievements
Rank 2
answered on 28 Jul 2011, 03:13 PM
Hello Didie,

It's OK.
Thank you very much for your quick reply.

Best wishes...
Mahmut
Tags
GridView
Asked by
Mahmut
Top achievements
Rank 2
Answers by
Dimitrina
Telerik team
Mahmut
Top achievements
Rank 2
Share this question
or