Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hey All,
I'm having a lot of trouble adding a tree view to a project I'm working on and need some advise

I have a partial view that is supposed to load a list of categories from this stored procedure
XML
List<spTestResult> CategoryList = DB.spTest().ToList();

Inside the returned result is a table with these Ids:
CategoryID, CategoryName, CategoryParentID


If the CategoryParentID of a folder is equal to the CategoryID of another its supposed to become its child on the treeview.

I'm completely new to MVC and all of the example links i've found Hardcode the values inside the treeview so I have no idea how to add the link between displaying the data and using that stored procedure list I returned earlier.
I imagined I would be using Jquery UI but the examples I found also hard coded all the values.

Can someone give me some pointers on how its supposed to work? I've made a treeview on webforms plenty of times but on Mvc we don't seem to have a treeview control to use in the first place.

Thanks in advance, If you need any more code or I missed anything feel free to tell me, I'm not sure if I covered the issue fully
Posted
Updated 20-Mar-12 5:33am
v2

Once you have your data returned from DB as flat table you need to group it based on your key columns. You coul use either CollectionView[^] implementation class or LINQ Group By[^] feature.
For more information see respective links.
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900