Fileexplorer custom file upload and refresh

8 posts, 0 answers
  1. M van der Kolk
    M van der Kolk avatar
    5 posts
    Member since:
    Aug 2009

    Posted 05 Nov 2009 Link to this post

    I'm developing an application with a fileexplorer control on it. On the page, above the fileexplorer control, I have a custom file upload function, so I disabled the add button in de fileexplorer's toolbar.

    I'm having trouble to display the newly added file in the content of the fileexplorer control. I upload the file in the current folder of the control.
    I've tried using the server-side function DataBind() to refetch the contents of the folder, but that didn't work. 

    Second, I've added a client-side function on the OnClientLoad event, with the following content:
    function refreshAfterUpload(explorer, args)
    {
        if (newImage)
            explorer.refresh(explorer.get_currentDirectory());
    }
    The js variable newImage is set server side when i've added a document. This also doesn't work.

    The last option I tried was calling the serverside function FileExplorer.Grid.Rebind(). However, during the postback and the upload of the new file, FileExplorer.Grid is null. 

    Can anybody help me? After I upload a new file in the current folder of the fileexplorer control, I want to be able to see it.


  2. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 10 Nov 2009 Link to this post

    Hi,

    I am not quite sure that I understood your scenario. I prepared a test project, but I was not able to reproduce the described behavior. Could you please modify it, open a new support ticket and send it back? I will check it and do my best to provide a working solution as soon as possible.

    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. M van der Kolk
    M van der Kolk avatar
    5 posts
    Member since:
    Aug 2009

    Posted 07 Dec 2009 Link to this post

    Thank you for your reply. I did some testing to reproduce the problem in your solution. I've found out that if you set the ExplorerMode option to "FileTree", the uploaded file isn't shown directly after the upload, but only after a next postback.

    I've tried to attach a zipfile to this thread, but I can only upload images. I've made a screenshot of my Default_VB.aspx.
  5. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 09 Dec 2009 Link to this post

    Hello,

     Could you please try calling this code in the Page_Load event when a new file is uploaded?

    RadFileExplorer1.TreeView.Nodes.Clear();

    That code will force the RadFileExplorer control to rebind itself.

    I hope this helps


    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.
  6. Thannapan Boonpannaruk
    Thannapan Boonpannaruk avatar
    3 posts
    Member since:
    Nov 2009

    Posted 15 Dec 2009 Link to this post

    Hi

    How should I do if I want to custom upload when the page is loaded ??

     

    protected void Page_Load(object sender, EventArgs e)

     

    {

     

        if (!IsPostBack)

     

       {

             // Here it is !! I want to Show the upload dialog from FileExploer  !!
       }
    }


    /////////////////////
    Thanks,
    NaPann
  7. Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 17 Dec 2009 Link to this post

    Hello Thannapan,

    In order to show the RadUpload dialog you need to render a JavaScript function from the server. In the function you need to follow these steps:

    • Get reference to the RadFileExplorer's client-side object
    • Get reference to the radtoolbar (embedded in RadFileExplorer)
    • Get reference to the Upload button
    • Finally call the click method of the button
    For your convenience I have implemented these steps in a project and attached it to the thread.
    I hope this helps.

    All the best,
    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.
  8. Rohan
    Rohan avatar
    94 posts
    Member since:
    Jul 2012

    Posted 25 Oct 2012 Link to this post

    Hi all,
    I have following scenario , i have external list of user , when selecting user in list ,i want to select the user folder on file explorer tree and according to selected node i also want to refresh grid in file explorer , i am capable to do all these thins but i am not able to refresh rad file explorers rad grid after selecting the node in tree from client side .... i also try for clear clearFolderCache and  
       var explorer = $find("<% = FileExplorer1.ClientID %>");
       explorer.refresh(nodes[i]);

    but not able to get result ,,,please provide and solution or any example or any site to complete my requirement..
    thanks
  9. Vessy
    Admin
    Vessy avatar
    1380 posts

    Posted 30 Oct 2012 Link to this post

    Hi Rohan,

    You could achieve the desired functionality by using the FileExplorer's loadFolder() method. It would set both the focus to a specific folder and load its content in the Grid. The path, which is passed as a first parameter to loadFolder() method must be the same as the path to that folder, displayed in the FileExplorer's AddressBar (and it must begin with a "/"):
    Copy Code
    <telerik:RadFileExplorer runat="server" ID="RadFileExplorer1" Width="520px" Height="520px" OnClientLoad="OnClientLoad">
        <Configuration ViewPaths="~/Images" UploadPaths="~/Images" DeletePaths="~/Images"/>
    </telerik:RadFileExplorer>
    <script type="text/javascript">
        function OnClientLoad(explorer, args) {
            explorer.loadFolder("/ROOT/Images/4/", false);
        }
    </script>

    In a similar way you could pass the specific user's folder as a value to the loadFolder() method.

    Regards,
    Vesi
    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