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

Refresh content after page load (with custom content provider)

2 Answers 89 Views
FileExplorer
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 17 Aug 2010, 10:45 AM
I have a setup where a custom content provider is used for the RadFileExplorer.

Which content to load in the FileExplorer is not know at time of page load, but is instead known after a button handler has fired. Is there a way to "re-populate" the FileExplorer (force the FileExplorer to re-run ResolveRootDirectoryAsTree() etc)?

I've only been able to make the FileExplorer run its "population methods" (ResolveRootDirectoryAsTree etc) if I initiate it in Page_Load (setting ViewPaths and ContentProviderTypeName). Doing the same at any later stage doesn't trigger the population methods.

2 Answers, 1 is accepted

Sort by
0
Accepted
Fiko
Telerik team
answered on 19 Aug 2010, 01:10 PM
Hello Andreas,

Page_Load is the latest event, where you can set the paths properties of the RadFileExplorer control.
You can achieve the desired result, however, by using buttons as well. I prepared a demo for you which shows the exact steps that you need to follow in order to achieve the desired result. Please find it attached to the thread and let me know whether it fits your requirements.

Regards,
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
Andreas
Top achievements
Rank 1
answered on 20 Aug 2010, 08:38 AM
It workes beautifully Fiko, thank you.

What I'm doing now is intercepting button click events that loads file explorer data depending on a selected element in the gui. For convenience, in my interception, I use the click handler method of the intercepted button to do the actual initiation/load. Then I prevent the actual event from firing (causing the method to be run twice) by temporarily removing the click event.

Example

// Run in Page_Load
    private void InterceptEventsForPreloadOfFileExplorer()
    {
        Control postbackControl = this.GetPostBackControl(); // Extension method

        if (postbackControl != null)
        {
            if (postbackControl.ID == btnModalOpenProjectTypeOK.ID)
            {
                btnModalOpenSelectedItem_Click(null, null);
                btnModalOpenSelectedItem.RemoveClickEvent(); // Extension method
            }

....

RemoveClickEvent courtesy of http://stackoverflow.com/questions/1372039/how-to-stop-a-event-from-firing-asp-net/1372524#1372524
Tags
FileExplorer
Asked by
Andreas
Top achievements
Rank 1
Answers by
Fiko
Telerik team
Andreas
Top achievements
Rank 1
Share this question
or