You can use FileManager as a "file picker", this is demonstrated in this example:
You set the ClientChosen event:
<GleamTech:FileManager ID="fileManager1" runat="server"
ClientChosen="fileManagerChosen"
Chooser="True">
</GleamTech:FileManager>
Then you insert your javascript event handler in the page (in <head> tag)
<script>
function fileManagerChosen(sender, eventArgs) {
if (eventArgs.IsCanceled) {
alert("Canceled!");
return;
}
var text = "ParentFullPath: " + eventArgs.ParentFullPath;
text += "\nItems: ";
for (var i = 0; i < eventArgs.Items.length; i++) {
var item = eventArgs.Items[i];
text += "\n\tName: " + item.Name;
text += "\n\tFullPath: " + item.FullPath;
text += "\n\tIsfolder: " + item.IsFolder;
text += "\n";
}
alert(text);
}
</script>
These are the properties you may be interested in:
- Chooser property, when set to true, displays the control as a file/folder chooser. In chooser mode, "Choose" and "Cancel" buttons will be displayed at the bottom of the control and double-clicking on a item of allowed type will choose that item instead of doing the default action (download/explore).
- ChooserType property specifies the item type that will be allowed to be chosen in chooser mode. Possible values are File, Folder and FileOrFolder. If omitted, File will be used.
- ChooserMultipleSelection property, when set to true, allows multiple item selections in chooser mode.
- ClientLoading, ClientLoaded and ClientChosen properties specifies the client-side events. ClientLoading is raised before control is loaded and ClientLoaded is raised after control is loaded. ClientChosen is raised after user chooses items when using chooser mode. The value should be a valid JavaScript function name which is accessible on the host page. Function names should be specified without parentheses like FunctionName or Namespace.FunctionName. Example function:
function fileManagerLoaded(sender, eventArgs) { var fileManager = sender; }
- ModalDialog property, when set to true, displays the control within a modal dialog which masks the parent element. If FullViewport mode is active then the modal dialog will mask the browser's viewport instead.
- ModalDialogTitle property specifies the title of the modal dialog.
- ShowOnLoad property, when set to false, hides the control when page is loaded. This is useful when the control will be displayed later on client-side manually. For example, the control can be displayed via a button's click event.