Swapnil Nandane

Swapnil Nandane

  • NA
  • 121
  • 17.3k

Convert table data to tree structure using C#

Jul 22 2016 9:20 AM
Hello
I have table that contains following data
 
id      parentid      name
1        NULL          A
2           1               B
3           1              C
4           1              D
5           2              E
6           3              F
7           4              G
8           6              H
9           6              I
10         7              J
11          8              K
12          9                L
13        10              M
14        15              N
15        7                O
 
I got this data as list now i want to convert this data in tree structure in C# as following format
 
A
-- B
   -- E
-- C
   -- F
      -- H
         -- K
      -- I
         -- L
-- D
   -- G
      -- J
         -- M
      -- O
         -- N
 
 

Answers (1)