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

change paths in codebehind

13 Answers 438 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Marlou
Top achievements
Rank 1
Marlou asked on 01 Dec 2009, 03:48 PM
Hi!

I have a fileexplorer in an usercontrol. When i select an order on my normal page, it will set a property in the usercontrol. Based on that property, the initialpath, updatepaths, viewpaths and deletepaths should be changed. But somehow i can't get this to work. I can't do this in the page_Load event or FileExplorer_Load event because the property won't be set at this time. What is the right time to do this and how should i do this?

Regards,
Marlou

13 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Dec 2009, 12:33 PM
Hello Marlou,

One suggestion would be Configuring RadFileExplorer when selecting the order from the page. Access the FileExplorer placed in user control as shown below.

CS:
 
    protected void Button1_Click(object sender, EventArgs e) 
    { 
        RadFileExplorer fe1 = (RadFileExplorer)WebUserControl1.FindControl("RadFileExplorer1");   
        //Configure the FileExplorer 
    } 

Checkout the following documentation that shows how to configure RadFileExplorer from code behind.
Configuring RadFileExplorer on the server

-Shinu.
0
Marlou
Top achievements
Rank 1
answered on 02 Dec 2009, 01:17 PM
Hi Shinu,

Thanks for your reply! The problem is that i can talk to the fileexplorer and i set the paths like this:

 

string path = string.Format("~/Documents/{0}/", order.Number);   
 
string[] paths = new string[] { path };   
 
FileExplorer1.Configuration.ViewPaths = paths;   
FileExplorer1.Configuration.DeletePaths = paths;  
FileExplorer1.Configuration.UploadPaths = paths;  
 
 

But the path doesn't seem to change, and i can't upload files. Am i missing something?

Regards,
Marlou

 

 

0
Fiko
Telerik team
answered on 02 Dec 2009, 03:40 PM
Hi Marlou,

The Page_Load event is the latest one, where you can set the paths properties of the RadFileExplorer control. You set the properties after that event and this is the reason for the unexpected behavior in your case.
I am not quite sure what control triggers the postback in your scenario ("When i select an order..."). Could you please provide a little bit more information about your scenario? Once I have a better view over your setup I will do my best to help.
 

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
Marlou
Top achievements
Rank 1
answered on 02 Dec 2009, 03:49 PM
Hi Fiko,

When i click an order, it's causing a postback so the usercontrols get's loaded. Then the next event is the rowcommand of the ordergrid. The usercontrol has a property OrderID. So in that event the OrderID property get's set. But the load event already has fired than, so that's why i cant set the property in the load event. I hope i made it clear, if not just ask me :)

Thank you for your help!
Marlou
0
Fiko
Telerik team
answered on 02 Dec 2009, 04:08 PM
Hi Marlou,

The Page_Load event is the latest one, where you can set the paths properties of the RadFileExplorer control. You set the properties after that event and this is the reason for the unexpected behavior in your case.
I am not quite sure what control triggers the postback in your scenario ("When i select an order..."). Could you please open an new support ticket and send me a runnable project? I will do my best to implement the desired behavior in it and send it back.
 

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
Marlou
Top achievements
Rank 1
answered on 03 Dec 2009, 08:14 AM
Hi Fiko,

I've made the project. The support ticket ID = '263766 '. Thanks for your help

Regards,
Marlou
0
Accepted
Fiko
Telerik team
answered on 04 Dec 2009, 01:43 PM
Hello Marlou,

I have already answered your ticket with ID=263766.

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
Marlou
Top achievements
Rank 1
answered on 08 Dec 2009, 08:30 AM
Hi Fiko,

Thanks for your solution. This was exactly what i needed. The only thing i've changed is to only reset the OrderID session when the linkbutton control is clicked, otherwise i wasn't able to upload files cause the paths weren't set.

Regards,
Marlou
0
Thomas Wong
Top achievements
Rank 1
answered on 25 Aug 2010, 05:31 AM
This is the exact problem I have.  Can you share what you replied to the original poster's support ticket?

If I change the ViewPaths property for the FileExplorer1 in the post back, the FileExplorer1 doesn't reflect the new path, even when I update the ViewPaths property in Page_Load event.

Basically, I have a drop down list that contains a list of directories that the user have permission to see, and depending on which one they select is the one that I send the FileExplorer1's ViewPaths property to.

Thanks,

Tom
0
Fiko
Telerik team
answered on 27 Aug 2010, 05:21 PM
Hi Thomas,

I have attached a sample for you, which shows the exact steps that you need to follow in order to achieve the desired result.

All the best,
Fiko
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Karl Wilkens
Top achievements
Rank 1
answered on 22 Dec 2011, 10:55 AM
Hi,

I am running into slightly different issues. We are setting the FileExplorerPath, in code behind, in Page Load - every time per your sample code. We are uploading files which then display in the explorer control correctly and they are uploaded to the target directory as expected.

My issue is the FileExplorer's display after a delete. I select a file, click delete, confirm and the file still appears in the RadFileExplorer, even though it is deleted from the file directory, as verified in Windows Explorer.

If I change the RadFileExplorer's target directory, and then change it again, and use the path to the folder where I deleted the file, the display is correct and the deleted file is not present.

So in summary, how do we refresh the FileExplorer after a delete? It does not seem to be doing this correctly when we set the paths dynamically in code behind.

FYI, here is what we are doing in page load every time (VB.net). targetDirectory is resolved using Page.ResolveURL - not shown here for brevity. Any insights greatly appreciated.
             

             

  RadUpload1.TargetPhysicalFolder = Page.ResolveUrl(targetDirectory)

                RadFileExplorer1.Configuration.ViewPaths = New String() {folderstring}

                RadFileExplorer1.Configuration.DeletePaths = New String() {folderstring}

                RadFileExplorer1.Configuration.UploadPaths = New String() {folderstring}

                RadFileExplorer1.Configuration.MaxUploadFileSize = 300000000


Two final notes. First, if I click the refresh icon in the toolbar, I get an error - Invalid characters in folder name even though the folder is fine (example - ~/Uploads/PeteBatra_6697 )
Second, I tried the client side refresh method without success. I had correctly wired the 

OnClientDelete to my javascript function and called refresh. This triggers the refresh animation - spinning circle - endlessly. The animation never goes away/completes.

0
Dobromir
Telerik team
answered on 26 Dec 2011, 03:28 PM
Hi Karl,

We are not aware of such problem and you are the first one to report it. Could you please provide more detailed information on the specific scenario?
  • Which version of RadControls for ASP.NET AJAX and .NET Framework are used in the application?
  • Under which browser and its version the problem occurs?
  • Are there any JavaScript error's thrown during page load and / or when deleting a file?
  • Do you have any customizations applied to the explorer - any client-side event handlers assigned, triggering functionality using the control's client-side ASP?
  • Could you please provide a simple fully runnable project reproducing the problem so we can investigate it further?

Regarding the issues described in the end:
  1. This error message can occur if the path set to the InitialPath property of RadFileExplorer is not correct format. Experiencing this error when Refresh button is clicked makes me believe that the configuration of RadFileExplorer is not correct - the provided code snippet does not provide the value of the folderstring variable assigned to the explorer's path properties.
  2. This is expected behavior - deleting a file is performed by an AJAX call triggered internally by the RadFileExplorer, calling refresh() manually in the OnClientDelete handler triggers additional AJAX request which interrupts the previous request causing the initial delete request to never complete.

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
0
Karl Wilkens
Top achievements
Rank 1
answered on 27 Dec 2011, 07:13 PM
Thanks that did the trick. It was slightly unclear in the documentation that you needed to set both InitialPath AND the View,Delete,Upload Paths. I was under the impression you just needed to set the later. In anycase all is well now. Thanks!
Tags
FileExplorer
Asked by
Marlou
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Marlou
Top achievements
Rank 1
Fiko
Telerik team
Thomas Wong
Top achievements
Rank 1
Karl Wilkens
Top achievements
Rank 1
Dobromir
Telerik team
Share this question
or