private JsTreeModel GetTreeData(string rootDirectory)
        {
            JsTreeModel rootNode = new JsTreeModel();
            rootNode.attr = new JsTreeAttribute();
            rootNode.data = "ROOT";
            string rootPath = rootDirectory;// Request.MapPath("/Root");
            rootNode.attr.id = rootPath;
            PopulateTree(rootPath, rootNode);

            return rootNode;
        }
 public void PopulateTree(string dir, JsTreeModel node)
 {
     if (node.children == null)
     {
         node.children = new List<JsTreeModel>();
     }
     // get the information of the directory
     DirectoryInfo directory = new DirectoryInfo(dir);
     // loop through each subdirectory
     foreach (DirectoryInfo d in directory.GetDirectories())
     {
         // create a new node
         JsTreeModel t = new JsTreeModel();
         t.attr = new JsTreeAttribute();
         t.attr.id = d.FullName;
         t.data = d.Name.ToString();
         // populate the new node recursively
         PopulateTree(d.FullName, t);
         node.children.Add(t); // add the node to the "master" node
     }
     // lastly, loop through each file in the directory, and add these as nodes
     //foreach (FileInfo f in directory.GetFiles())
     //{
     //    // create a new node
     //    JsTreeModel t = new JsTreeModel();
     //    t.attr = new JsTreeAttribute();
     //    t.attr.id = f.FullName;
     //    t.data = f.Name.ToString();
     //    // add it to the "master"
     //    node.children.Add(t);
     //}
 }