These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Set FileManager control to specific folder

hI I am evaluating the trial version and trying to integrate The FieVista control into a larger admin application

I was wondering if there is a way to traverse the folder structure and set the currently selected folder to a specfic folder and have that folder's content show up in the content pane.

Ex: Root folder c:\admin\Root folder

Root folder contain subfolders 
subfolder1
subfolder2
subfolder3

I would like to have all three subfolders display but show subfolder3 as selected folder and have contents display in content pane.

Any help you could provide you be appreciated!.
Anthony 11/21/2012 12:35 PM
Hi Anthony,
Thanks for your interest in our product.
Yes it's possible to do what you need.

You should first register a client loaded event:

<GleamTech:FileManager ID="fileManager" runat="server" ClientLoaded="fileManagerLoaded" > ...

Then in the host page you should add this javascript function:

function fileManagerLoaded(sender, eventArgs) {
    var fileManager = sender;
    
    //You can get the target subfolder name from a global var or a dom element if you wish
    var targetSubfolder = "subfolder3";
    
    setTimeout(function () {
    
        //Get first root folder with index 0
        var rootTreeNode = fileManager.TreeView.root.childNodes[0];
            
        if (rootTreeNode.loading) {
            //If subfolders are still not loaded, wait again by calling the function after 200ms
            setTimeout(arguments.callee, 200);
        } else {
            
            var treeNode = null;
                
            //Find the treeNode that matches targetSubfolder name
            for (i = 0; i < rootTreeNode.childNodes.length; i++)
                    if (rootTreeNode.childNodes[i].text == targetSubfolder
                        || rootTreeNode.childNodes[i].text.toLowerCase() == targetSubfolder.toLowerCase()) {
                            treeNode = treeNode.childNodes[i];
                            break;
                    }
                
            if (treeNode != null)
                treeNode.Select();
        }

    }, 200);
    
}
Cem Alacayir 11/21/2012 1:45 PM
Awesome Thanks CEM!!
Anthony 11/23/2012 6:40 AM