File manager, set folder and file name in the code.
Problem reported by Daniel Molasy - 9/21/2025 at 12:55 PM
Resolved
Is this possible to set specific zip file to be selected by default in FileManager?
I am passing this parameter "~/App_Data/RootFolder1/test.zip";
How to tell FileManager to select test.zip in file manager viewer ?
In ~/App_Data/RootFolder1 I have hunderts of zip file and I need to set name of zip file in code.
Somethink like this:
rootFolder.Location = "~/App_Data/RootFolder1";
rootFolder.Location.SelectedFile = "test.zip"
Is this possible?

Cem Alacayir Replied
Employee Post
Did you try FileManager.InitialFolder property?

InitialFolderGets or sets the folder that should be selected and displayed initially. Default is "first". The value can be shortcuts like "first", "last" or the full path of the folder specified in format "[RootFolderName]:\Some\Folder". When set to null or empty string, no folder will be selected and displayed initially.

Note that you can directly specify the zip file as it will be treated as a folder:

fileManager.InitialFolder = @"[RootFolderName]:\SomeFolder\test.zip";

fileManager.InitialFolder = FileManagerRootFolder.GetFullPath(rootFolder.Name, @"SomeFolder\test.zip");

Daniel Molasy Replied
Hi Cem

I can't set zip file as InitialFolder.
In Root folder I have normal folders and zip files.
When I set Initial Folder to (Folder One, Folder Two, test, test1) it works without problem.
But when I set Initial Folder to any zip or rar file like (testD.zip, TestD1, testRar.rar, 04606644.zip) it will not work.
Are you sure that zip file can be set as Initial Folder ?

Cem Alacayir Replied
Employee Post Marked As Resolution
Ok, we added a new property for this purpose, Version 9.8.2 - October 20, 2025:
  • Added:FileManager.InitialSelection property.
    Gets or sets the items (files or subfolders) that should be selected initially.
    Default is null.
    If InitialFolder was set, items inside that folder will be selected.
    When set to null or empty array, no items will be selected initially.


So now you can do this:
fileManager.InitialSelection = new[] { "test.zip" };
Optionally you can first open a folder and then do the selection in that folder:
fileManager.InitialFolder = FileManagerRootFolder.GetFullPath(rootFolder.Name, @"Some\Folder");
fileManager.InitialSelection = new[] { "test.zip", "testD.zip" };
> Are you sure that zip file can be set as Initial Folder ?
Yes indeed it doesn't work because zip file is not an actual folder so it's not initially available in the folder tree, it's added there after the parent folder is actually opened.

Reply to Thread

Enter the verification text