Refresh content after page load (with custom content provider)

3 posts, 1 answers
  1. Andreas
    Andreas avatar
    12 posts
    Member since:
    Aug 2010

    Posted 17 Aug 2010 Link to this post

    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. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 19 Aug 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Andreas
    Andreas avatar
    12 posts
    Member since:
    Aug 2010

    Posted 20 Aug 2010 Link to this post

    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
Back to Top