RadFileExplorer Custom Context Menu Item Progress Indicator

6 posts, 0 answers
  1. Adam
    Adam avatar
    19 posts
    Member since:
    Dec 2011

    Posted 19 Apr 2012 Link to this post

    I'm posting this to see if anyone has accomplished this.  I have been trying for a couple of days and am ready to give up.
    I have a RadFileExplorer and have added a custom context menu item called Download.  This button action will Download a file or folder from the server to the client computer.  If the download is a folder I zip up the contents of that folder first and then present the download using Response.TransmitFile.  Pretty straight forward.  The problem comes that when you select a folder that is large the zip process may take a while.  I want to notify the client of the progress.  I am already using the RadProgressArea for the Upload control of the RadFileExplorer so I have AllowCustomProgress set to false in the web.config so that it won't show up when selecting the Download. 

    Below is my code for the download click client event:

     

    function extendedFileExplorer_onGridContextItemClicked(oGridMenu, args) {

     

     

    var menuItemText = args.get_item().get_text();

     

    switch (menuItemText) {

     

    case "Download":

    extendedFileExplorer_sendItemsPathsToServer();

     

    break;

     

    case "Share":

     

    var fExplorer = $find("<%= RadFileExplorer1.ClientID %>");

     

    var item = fExplorer.get_selectedItem();

     

    var owindow = window.radopen("ShareResource.aspx?path=" + item.get_path(), "ShareResourceWindow");

     

    return false;

     

    break;

    }

    }

     

    function extendedFileExplorer_sendItemsPathsToServer() {

     

    var oExplorer = $find("<%= RadFileExplorer1.ClientID %>"); // Find the RadFileExplorer ;

     

    var selectedItems = oExplorer.get_selectedItems(); // Retrieve the selected items ;

     

    var selectedItemsPaths = extendedFileExplorer_combinePathsInAString(selectedItems); // Get the paths as a string in specific format ;

     

    var hiddenField = $get("<%= ctlHiddenField.ClientID %>"); // Find the hiddenField

    hiddenField.value = selectedItemsPaths;

    __doPostBack(

     

    "<%= btnDownload.UniqueID %>", ""); // Call the 'btnDownload_Click' function on the server ;

    }

     

    function extendedFileExplorer_combinePathsInAString(arrayOfSelectedItems) {

     

    var itemPaths = new Array();

     

    for (var i = 0; i < arrayOfSelectedItems.length; i++) {

     

    // Pass all the selected paths ;

    itemPaths.push(arrayOfSelectedItems[i].get_path());

    }

     

    // Return a string that contains the paths ;

     

    return itemPaths.join("|");

    }


    So this fires off the btnDownload button click event on the server.  From there I am using the DotNetZip library which has tons of progress feedback events that I can access.  So I need to notify the client of some of those events like which file is compressing and total percentage completed.  Has anyone ever tried something like this and made it work?

    Thanks,
    Adam
  2. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 24 Apr 2012 Link to this post

    Hi Adam,

    Unfortunately, I will have to disappoint you, it is not possible to toggle the value of this setting dynamically, thus you cannot enable custom progress only for specific cases.

    Kind regards,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Rohan
    Rohan avatar
    94 posts
    Member since:
    Jul 2012

    Posted 29 May 2012 Link to this post

    Hi all
     I am implementing the custom content provider for file explore  using SQL. i want get the file id on onGridContextItemClicked .
    how can i get ....
  5. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 29 May 2012 Link to this post

    Hi Rohan,

    In order to pass specific value for each item listed in the explorer, I would suggest you to add it as a custom attribute to the FileItem / DirectoryItem in the ResloveDirecotury() method of the content provider. Please take a look at the following live demo using this approach:
    FileExplorer / Add custom columns

    Then you can access the custom attribute in the following manner:
    explorer.get_grid().get_selectedItems()[0].get_dataItem().Attributes['customAttribute'];


    Kind regards,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  6. Rohan
    Rohan avatar
    94 posts
    Member since:
    Jul 2012

    Posted 12 Jul 2012 Link to this post

    Hi all ,
    I want to get file or folder  name on  onGridContextItemClicked at client side ,
    I am able to get custom attributes by using this code
    explorer.get_grid().get_selectedItems()[0].get_dataItem().Attributes['customAttribute'];
     but not able to get file or folder name ,it gives undefined ......
    how can i get the file name at client side using onGridContextItemClicked  event ....
  7. Dobromir
    Admin
    Dobromir avatar
    1633 posts

    Posted 17 Jul 2012 Link to this post

    Hi Rohan,

    You can get the name of the File / Directory related to the context menu through the selectedItem's dataItem, e.g.:
    function explorerLoad(explorer){
        explorer.get_gridContextMenu().add_itemClicked(function(sender, args){
            alert(explorer.get_grid().get_selectedItems()[0].get_dataItem().Name);
        })
    }


    All the best,
    Dobromir
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017