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

[Solved] Relationship grouping ?

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Gaël
Top achievements
Rank 1
Gaël asked on 15 Jan 2010, 09:07 AM
Hi Everyone,

I have a table like that :
 ----------------------------------------
|    id    |    ParentId    |    Name    |
 ----------------------------------------
|    1     |      NULL      |    Field 1   |
|    2     |          1         |    Field 2   |
|    3     |          1         |    Field 3   |
|    4     |          2         |    Field 4   |
|    5     |          3         |    Field 5   |
|    6     |          3         |    Field 6   |
|    7     |          2         |    Field 7   |
|    8     |          1         |    Field 8   |
 -----------------------------------------

Is it possible to group this into the grid in order to have a result displayed like that ? :

 ----------------------------------------
|               My RadGrid                 |
 ----------------------------------------
|    > Grouped By Field 1              |
|        > Grouped by Field 2          |
|           - Field 4                            |
|           - Field 7                            |
|        > Grouped by Field 3          |
|           - Field 5                            |
|           - Field 6                            |
|    > Grouped By Field 8              |
 -----------------------------------------

Then there is inside the same table 3 kind of records:
First level haven't ParentId
Second Level have in ParentId the Id of the first level
Third level have in ParentId the id of the second level

Is it possible ? because right now, I've just achieve to group by ParentId and there is no hierarchy
like that
> First Level
> All the Second Level
>Third Levels
>Third Levels
>...

Thanks in advance
Gaël Huyghe

1 Answer, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 20 Jan 2010, 01:45 PM
Hello Gaël,

You could have multilevel grouping levels, however they have to be based on different criteria. For more information about grouping, please refer to this online documentation article:

http://www.telerik.com/help/aspnet-ajax/grdbasicgrouping.html

In your case you could use RadGrid with self-referencing hierarchy instead of using grouping. You could build multiple levels of a hierarchical grid using a single table in the data source by specifying relations inside the same table:

http://www.telerik.com/help/aspnet-ajax/grdselfreferencinghierarchy.html

For your convenience I am attaching sample demonstrating how you could use grid with self-referencing hierarchy to achieve the desired functionality.

I hope this helps.

Regards,
Radoslav
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.
Tags
Grid
Asked by
Gaël
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Share this question
or