Hi,
Just about to purchase the component, wonder if there is an example of how to get the path & name of the currently selected file?
Cheers
Matthew
11/24/2011 12:33 AM
For FileUltimate v3.x, you can use this to get the selected file name on the client-side:
var fileName = fileManager.GridView.GetSelectedFirstRow().GetCellValue(fileManager.GridView.columns.Name);
where "fileManager" is the control ID as in <GleamTech:FileManager ID="fileManager"> tag.
If you need to get multiple selected items then you can use this to get an array of file names:
var fileNames = fileManager.GridView.GetSelectedCellValues(fileManager.GridView.columns.Name);
You can get the path with
var path = fileManager.CurrentFolder.Path;
Note that this path is relative to the root folder. You are not allowed to get the physical path on the client-side for security reasons.
If you really need the physical path then first you should also get rootfolder index and instance id:
var rootFolderIndex = fileManager.CurrentFolder.RootFolderIndex;
var instanceID = fileManager.Parameters.InstanceID;
and then you should pass these 3 variables (instanceID, rootFolderIndex and path) to the server side to generate the physical path:
FileManagerState state = FileManager.GetState(instanceID);
FileManagerRootFolder rootFolder = state.RootFolders[rootFolderIndex];
string physicalPath = rootFolder.MapPath(path);
Cem Alacayir
11/24/2011 1:55 AM