This is a migrated thread and some comments may be shown as answers.

Fileexplorer custom file upload and refresh

7 Answers 389 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
M van der Kolk
Top achievements
Rank 1
M van der Kolk asked on 05 Nov 2009, 09:01 AM
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.


7 Answers, 1 is accepted

Sort by
0
Fiko
Telerik team
answered on 10 Nov 2009, 03:50 PM
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.
0
M van der Kolk
Top achievements
Rank 1
answered on 07 Dec 2009, 10:26 AM
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.
0
Fiko
Telerik team
answered on 09 Dec 2009, 02:06 PM
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.
0
Thannapan Boonpannaruk
Top achievements
Rank 1
answered on 15 Dec 2009, 10:21 AM
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
0
Fiko
Telerik team
answered on 17 Dec 2009, 03:01 PM
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.
0
Rohan
Top achievements
Rank 1
answered on 25 Oct 2012, 02:22 PM
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
0
Vessy
Telerik team
answered on 30 Oct 2012, 12:10 PM
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.
Tags
FileExplorer
Asked by
M van der Kolk
Top achievements
Rank 1
Answers by
Fiko
Telerik team
M van der Kolk
Top achievements
Rank 1
Thannapan Boonpannaruk
Top achievements
Rank 1
Rohan
Top achievements
Rank 1
Vessy
Telerik team
Share this question
or