Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > FileExplorer > change paths in codebehind

Answered change paths in codebehind

Feed from this thread
  • Marlou avatar

    Posted on Dec 1, 2009 (permalink)

    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

    Reply

  • Posted on Dec 2, 2009 (permalink)

    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.

    Reply

  • Marlou avatar

    Posted on Dec 2, 2009 (permalink)

    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

     

     

    Reply

  • Fiko Fiko avatar

    Posted on Dec 2, 2009 (permalink)

    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.

    Reply

  • Marlou avatar

    Posted on Dec 2, 2009 (permalink)

    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

    Reply

  • Fiko Fiko avatar

    Posted on Dec 2, 2009 (permalink)

    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.

    Reply

  • Marlou avatar

    Posted on Dec 3, 2009 (permalink)

    Hi Fiko,

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

    Regards,
    Marlou

    Reply

  • Answer Fiko Fiko avatar

    Posted on Dec 4, 2009 (permalink)

    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.

    Reply

  • Marlou avatar

    Posted on Dec 8, 2009 (permalink)

    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

    Reply

  • Thomas Wong avatar

    Posted on Aug 25, 2010 (permalink)

    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

    Reply

  • Fiko Fiko avatar

    Posted on Aug 27, 2010 (permalink)

    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
    Attached files

    Reply

  • Karl Wilkens Master avatar

    Posted on Dec 22, 2011 (permalink)

    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.

    Reply

  • Dobromir Dobromir admin's avatar

    Posted on Dec 26, 2011 (permalink)

    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

    Reply

  • Karl Wilkens Master avatar

    Posted on Dec 27, 2011 (permalink)

    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!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > FileExplorer > change paths in codebehind
Related resources for "change paths in codebehind"

ASP.NET FileExplorer Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]