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

RadWindow reloaded after a parent reload

2 Answers 35 Views
Window
This is a migrated thread and some comments may be shown as answers.
Pierre-Antoine DOUCHET
Top achievements
Rank 1
Pierre-Antoine DOUCHET asked on 05 Nov 2014, 10:19 AM
Hello,

I've got an issue with one of my RadWindow. I want to refresh the parent page when there's a change in the RadWindow. For that, I use an arg when I close the RadWindow and catch that in the parent page :

RadWindow script :
function GetRadWindow() {
    var oWindow = null;
    if (window.radWindow)
        oWindow = window.radWindow;
    else if (window.frameElement.radWindow)
        oWindow = window.frameElement.radWindow;
    return oWindow;
}
 
function CloseWindowsWithArgument(arg) {
    var oWindow = GetRadWindow();
    oWindow.close(arg);
}
 
function CloseWindows() {
    var oWindow = GetRadWindow();
    oWindow.close();
}

The two close functions are call like that :
string scriptCloseWindow = modifiedItemCount > 0 ? "CloseWindowsWithArgument('NewData')" : "CloseWindows()";
 
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "saveCustomRainFall", scriptCloseWindow, true);

In the parent page, I've got this script :
function WindowsRainFallNewClose(sender, eventArgs) {
    // Explicitely instructed to reload
    if (eventArgs._argument != null) {
        window.location.reload();
    }
}

The RadWindow is declared like that :
<telerik:RadWindowManager ID="Singleton" runat="server" Behavior="Default" InitialBehavior="None" EnableEmbeddedSkins="False"
    Left="" meta:resourcekey="SingletonResource1" Style="display: none;" Top="" VisibleOnPageLoad="False" EnableViewState="False">
    <Windows>
        <telerik:RadWindow ID="DialogWindow" Skin="Bayer" EnableEmbeddedSkins="false" Behaviors="Maximize,Move,Reload,Resize,Close"
            ReloadOnShow="True" ShowContentDuringLoad="False" VisibleOnPageLoad="False" EnableViewState="False" OnClientClose="WindowsRainFallNewClose"
            Left="250px" Modal="true" runat="server" Width="300px" Height="400px" Title="Custom Rain Fall"
            NavigateUrl="GFTDonRisk_CustomRainFallNew.aspx" VisibleStatusbar="false" meta:resourcekey="DialogWindow">
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

When the parent page is reloaded, the page contained in the RadWindow also reloaded and I don't want that. I use a global script to show a loading bar when the pages are loading and close it when they are loaded. On the reload, the RadWindow don't finish its reload and it's blocking my loading bar (see the attach file : in red, the radwindow page. in yellow, the parent page).

How can I do to avoid the loading of the radwindow page after the "window.location.reload();" ?

2 Answers, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 05 Nov 2014, 11:04 AM

Hello,

The short answer is that you cannot avoid the page reload in the RadWindow.

The window.location.reload() method of the main page will dispose the entire page, including the RadWindow and its content page, so the next time they load, a request has to be made.

To avoid this, you can consider using AJAX to refresh parts of the main page only, without disposing the RadWindow. If it is not included in the partial page rendering, it will not be disposed and its content page will not be automatically reloaded. You can find a similar example in this demo, which uses the ajaxRequest() method of the RadAjaxManager to update certain controls only. There are also other ways to initiate a partial postback.


Regards,

Marin Bratanov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Pierre-Antoine DOUCHET
Top achievements
Rank 1
answered on 05 Nov 2014, 11:07 AM
Thanks for your answer. I'll try that.
Tags
Window
Asked by
Pierre-Antoine DOUCHET
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Pierre-Antoine DOUCHET
Top achievements
Rank 1
Share this question
or