I have the hierarchy of an organization in the SQL database. It looks like this -
Main Manager
Manager - 1
Manager - 1.1
Manager - 1.1.1
Manager - 2
Manager - 2.1
Manager - 2.1.1
Manager - 2.2
etc.
I want to fetch the values in the database and convert to a jquery object just like the example below.
How can I fetch the sql data in the database in hierarchical order and create a jquery object like in the example below?
var data = { Name: "Manager - 1",
ID: "1",
children: [ {
Name: "Manager - 1.1",
ID: "1.1",
children: [ {
Name: "Manager - 1.1.1",
ID: "1.1.1"}
]
Name: "Manager - 1.2",
ID: "1.2",
children: [ {
Name: "Manager - 1.2.1",
ID: "1"}
]
}
]
};

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 15, 2013, 11:17 PM EST
r pRank #4,639 · 333 reputationPosted Nov 15, 2013, 11:50 PM EST
It has fields like - ID, ParentID and Name
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 16, 2013, 1:50 AM EST
r pRank #4,639 · 333 reputationPosted Nov 16, 2013, 1:56 AM EST
I mean I want the best and quickest way.
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 16, 2013, 2:35 AM EST
r pRank #4,639 · 333 reputationPosted Nov 16, 2013, 2:39 AM EST
Do you have any example?
Thanks,
Robins
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Nov 16, 2013, 4:01 AM EST
Follow the link for detailed article on EF Navigation Properties with source code
http://weblogs.asp.net/manavi/archive/2011/05/17/associations-in-ef-4-1-code-first-part-6-many-valued-associations.aspx