I have a unique sql database setup in which I'm using nested sets to determine the hierarchy. Here's an example of it:
HierarchyID = 1, HierarchyText = "Contract", HierarchyLeft = 1, HierarchyRight = 54
HierarchyID = 2, HierarhcyText = "Part 1...", HierarchyLeft = 2, HierarchyRight = 41
HierarchyID = 3, HierarchyText = "Part 2...", HierarchyLeft = 42, HierarchyRight = 45
HierarchyID = 8, HierarchyText = "General Provisions", HierarchyLeft = 3, HierarchyRight = 40
The idea is that the children (or subcategories) are contained within the parent's LEFT and RIGHT values. So, for instance, "General Provisions" is a child of "Part 1..." which is a child of "Contract". "Part 1..." and "Part 2" are siblings of each other since they don't contain each other going by the left and right values.
The question I have is this: Is there a way to use MVC3 with Razor Engine to create a tree and display it pulling from this database? The only examples I've seen have been databases that have each node in the database pointing to its parent. If it's possible, could you provide sample code for the CONTROLLER and VIEW? I'd appreciate that. Also, I'm able to pull the hierarchy names by level. So, I'd appreciate an example in which I could feed the tree control a level at a time. For instance, feed the top level... when the user clicks on it, feed the next leve, etc. down the tree. I would really appreciate any help!