Deleting files from tree

4 posts, 0 answers
  1. Devman
    Devman avatar
    3 posts
    Member since:
    Sep 2009

    Posted 17 Nov 2009 Link to this post

    Hello.

    I have a couple issues.
    Please note: The explorer mode is FileTree.

    1. I can't delete folders from the tree with the client method deleteItem(path, type) (http://www.telerik.com/help/aspnet-ajax/radfileexplorer-client-side.html). In my FileBrowserContentProvider method DeleteDirectory receives a wrong path (for example: if I make a call with path "28", I receive "8" in the method; if with path "29", I receive "9"). I temporarily use client method deleteSelectedItems() but

    oExplorer = $find(oExplorerID);oExplorer.deleteItem(oExplorer.get_selectedItem().get_path(), oExplorer.get_selectedItem().get_type()); 


    don't work.

    2. I can't delete files from the file tree. I call deleteSelectedItems() for the file but another method (DeleteDirectory) is called from FileBrowserContentProvider with the parent path of the folder instead of the method DeleteFile. I can't delete files from the file tree without my FileBrowserContentProvider either.

    oExplorer = $find(oExplorerID);
    oExplorer.deleteSelectedItems(); 


    Thanks.
  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 20 Nov 2009 Link to this post

    Hi Devman,

    I have investigated the described behavior and found that both issues are caused by a bug in RadFileExplorer's deleteItem method. I have logged it in our bug tracking system and we will do our best to fix this problem as soon as possible. For the time being I recommend you use the control in ExplorerMode="Default".

    Your Telerik points are updated.

    We apologize for the caused inconvenience.

    Best wishes,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Devman
    Devman avatar
    3 posts
    Member since:
    Sep 2009

    Posted 23 Nov 2009 Link to this post

    Hi, Fiko.

    I found a couple problems.

    1. If I set MultipleSelect false, it doesn't work.
    RadFileExplorer1.TreeView.MultipleSelect = false;  

    And still, I can select many folders/files.

    2. If I move folders/files in tree view, I can't call methods MoveDirectory and MoveFile from my FileBrowserContentProvider.

    Also, please let me know: how I can process response (string) from FileBrowserContentProvider. For example: this method CreateDirectory is called, and if the directory already exists (return "Folder already exists.";), and the alert with this text "Folder already exists." is returned and called. If the folder has been created, I return string.Empty. But how can I customize response? (call another client-side function; ResponseScripts, etc.).

    FYI,
    ExplorerMode="Default" does not work for me in this situation. For now I call AJAX requests directly. I hope my solution is temporary.

    Thanks for your help.
  4. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 25 Nov 2009 Link to this post

    Hi Devman,

    In reference to your questions:
    • The values of the most properties in the embedded controls in FileExplorer are overridden. In your case you could use this client-side approach instead:
      • Attach a handler to the OnClientLoad event of the RadFileExplorer
      • Implement the handler as follows:
        <script type="text/javascript">
            function OnExplorerLoad(oExplorer, args)
            {
                oExplorer.get_tree().set_multipleSelect(false);
            }
        </script>
        This code will disable multiple selection.
    • This code can be used inside ContentProvider's code in order to get reference to the page that contains the RadFileExplorer cpntrol:
      Page _page = Context.CurrentHandler as Page;

      Then you could use one of the approaches in order to execute JavaScript method. For example :
      _page.ClientScript.RegisterStartupScript(_page.GetType(), "Key", "alert('Message from content provider');", true);

    I hope this helps.

    Sincerely yours,
    Fiko
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top