javascripttelerikradwindow

clear Telerik radwindow content before showing


I have a Telerik RadWindow instance that gets reused to show different content on the same page. Once the RadWindow displays one page, and is closed, then that content stays loaded int the RadWindow until the RadWindow loads another page. The problem I'm running into is when I go to show new content int the RadWindow. I first call setUrl() from js to tell the RadWindow to load the new page. I then call show() on the RadWindow to display the window.

myRad.setUrl("http://www.foo.com/");
myRad.show();

At this point the RadWindow appears, but the old content is still there until the new page request finishes and the new page replaces the old content in the RadWindow. This can take a few seconds, and you don't really see any visual indication that the content is loading during that time.

Is there a way to force a RadWindow instance to clear its current content before loading a new url and displaying the Radwindow?


Solution

  • Set the RadWindow's ShowContentDuringLoad property to false. It works nicely with ReloadOnShow=true too.

    An alternative is to use the OnClientClose event and call sender.setUrl("about:blank") where sender is the first argument the handler receives.

    The third option is to set the DestroyOnClose property of the manager to avoid instances piling up and just open new ones each time, as you already started.

    If you need some links to see how to set the properties, ping me back in a comment and I will edit my answer.