We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Customizing ActionResult Download

Thread ID:

Created:

Updated:

Platform:

Replies:

149359 Nov 22,2019 06:43 PM UTC Nov 25,2019 11:16 AM UTC JavaScript - EJ 2 1
loading
Tags: FileManager
William
Asked On November 22, 2019 06:43 PM UTC

I'm adding a feature where double clicking on a file will open it via adding Process.Start in the public ActionResult Download(string downloadInput).  This works correctly, however, I want to remove the actual downloading of the file.  I've tried returning null and returning operation.Download(null, null); but it just redirects to localhost:12345/FileManager/Download.  How do I prevent the Download ActionResult from downloading?

Keerthana Rajendran [Syncfusion]
Replied On November 25, 2019 11:16 AM UTC

Hi William, 
 
Good day to you, 
 
We have checked your reported query about preventing the usual download operation. We suspect your requirement is similar to any of  the below possible cases. 
 
1)     If you don’t want to perform download using toolbar and context menu of file manager component. You can remove the download operations by using toolbarSettings and contextmenuSettings and also customize the operations based on your requirement. Refer the below code snippet. 
     // Toolbar settings customization 
        toolbarSettings: { items: ['NewFolder', 'Upload', 'Cut', 'Copy', 'Paste', 'Delete', 'Rename', 
      'SortBy', 'Refresh', 'Selection', 'View', 'Details' 
        ]}, 
       // Context Menu settings customization 
       contextMenuSettings: { file: ['Open', '|', 'Cut', 'Copy', '|', 'Delete', 'Rename', '|', 'Details'], folder: ['Open', '|', 'Cut', 'Copy', 'Paste', '|', 'Delete', 'Rename', '|', 'Details']} 
 
 
             Refer the sample link below. 
 
2)     If you want to perform custom download operation in both context menu and toolbar. In that case, you can prevent our existing download operations by using toolbarClick() and menuClick() event. In those events, you can filter the events based on the event argument to perform your custom operation.  
 
Refer to the below code snippet. 
   toolbarClick: function(args) { 
          if(args.item.text == "Download") { 
            args.cancel = true; 
            // Perform your custom download operations here 
          } 
        }, 
        menuClick: function(args) { 
          if(args.item.text == "Download" ) { 
             args.cancel = true; 
              // Perform your custom download operations here 
          } 
        } 
 
 
 
In our upcoming Volume 4 release which is expected to be rolled out by the mid of December, we have provided an event beforeDownload() for file manager component. Using that event, you can prevent our download operations and add your custom download operations there. Until then, you can use the above solution for your requirement. 
 
Please let us know, if you have any concerns. 
 
 
Regards, 
Keerthana.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon