Click here to Skip to main content
16,013,322 members
Please Sign up or sign in to vote.
4.50/5 (2 votes)
See more:
I want a tree view with code behind of JavaScript in which I just want to add path of files and it show me the whole directory in tree and when I select a node it show me the contents of file just like file explorer do. The nodes should be in divs.
Please give the links from where I can download the code.
Actually I want to build the tree of
JavaScript
var cars = [{
            "Root": "",
            "Node": "Pakistan",
            "SubNode": [{
                "Root": "Pakistan",
                "Node": "Punjab",
                "SubNode": [{
                    "Root": "Punjab",
                    "Node": "Lahore",
                    "SubNode": [{}]
                },
                {
                    "Root": "Punjab",
                    "Node": "Multan",
                    "SubNode": [{}]
                }]
            },
            {
                "Root": "Pakistan",
                "Node": "Khaiber",
                "SubNode": [{
                    "Root": "Khaiber",
                    "Node": "Peshawar",
                    "SubNode": [{}]
                },
                {
                    "Root": "Khaiber",
                    "Node": "Sawat",
                    "SubNode": [{}]
                }]
            },
            {
                "Root": "Pakistan",
                "Node": "Balochistan",
                "SubNode": [{
                    "Root": "Balochistan",
                    "Node": "Quetta",
                    "SubNode": [{}]
                },
                {
                    "Root": "Balochistan",
                    "Node": "Gawadar",
                    "SubNode": [{}]
                }]
            },
            {
                "Root": "Pakistan",
                "Node": "Sindh",
                "SubNode": [{
                    "Root": "Sindh",
                    "Node": "Karachi",
                    "SubNode": [{}]
                },
                {
                    "Root": "Sindh",
                    "Node": "Haiderabad",
                    "SubNode": [{}]
                }]
            }]
        }];
Posted
Updated 26-Dec-12 2:02am
v2

Hello,
Follow this given article, it will give you clear concept.

Populating a TreeView Control from the Database[^]

Thank you.
Rashed::Bangladesh
 
Share this answer
 
Comments
Ammar4556257 21-Dec-12 7:45am    
Thanks Humayun Bhai
But I am bound to use JavaScript
Hello, I think this example will better for you.

http://wwwendt.de/tech/dynatree/doc/samples.html[^]

Thanks.
Rashed::Bangladesh
 
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