How to get selected files?
Question asked by Olivier Lefebvre - November 10, 2017 at 3:16 AM
Answered
Hi,
 
I'm currently using FileUltimate in my MVC ASP.NET project.
Everything works quite good except that I'm unable to find the GridView element like in this old example:
https ://forums.gleamtech.com/4356/easy-way-to-get-selected-file
 
I would like to get the selected files and retrieve their informations.
 
Thank you.

2 Replies

Reply to Thread
0
Cem Alacayir Replied
Employee Post
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 FileFolder and FileOrFolder. If omitted, File will be used.
  • ChooserMultipleSelection property, when set to true, allows multiple item selections in chooser mode.
  • ClientLoadingClientLoaded 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.
 
0
Cem Alacayir Replied
Employee Post
FYI, as of FileUltimate v6.2.0, there is now also ClientSelectionChanged which can be used instead of ClientChosen when you are not using the Chooser mode.
 
Please see my reply here:
 

Reply to Thread