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

How to refresh the page? (Click button close RadWindow)

1 Answer 749 Views
Window
This is a migrated thread and some comments may be shown as answers.
Wiktor
Top achievements
Rank 1
Wiktor asked on 02 Dec 2013, 10:55 AM

I have 2 pages (Home and Сategory) Load page Home on there's button. Click button run panel RadWindow (NavigateUrl: Сategory).

protected void ShowWindow()
    {
        string script = "function f(){$find(\"" + RadWindow_editor.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
    }
    protected void RadButtonEdit_Click(object sender, EventArgs e)
    {
        ShowWindow();
    }

Load RadWindow NavigateUrl - Сategory on there's button. Click button close RadWindow.

protected void RadButtonEdit_Click(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "Close();", true);
        }
 function GetRadWindow() {
     var oWindow = null;
     if (window.radWindow)
         oWindow = window.radWindow;
     else if (window.frameElement.radWindow)
         oWindow = window.frameElement.radWindow;
     return oWindow; 
 }

 function Close() {
     var oWindow = GetRadWindow();
     oWindow.argument = null;
     oWindow.close();
     return false;
 }

How to refresh the page Home? (Click button close RadWindow)

Thank you!

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 02 Dec 2013, 03:17 PM
Hi Wiktor,

There are two ways to do this:

1) change the main page URL direclty from the function that closes the RadWindow:
function Close() {
    var oWindow = GetRadWindow();
    oWindow.argument = null;
    oWindow.close();
    oWindow.BrowserWindow.location = "newPage.aspx";
    //or location.reload() to invoke the browser reload command
    //or any other method related to the standard window.location object
    return false;
}

OR

2) use the OnClientClose event of the RadWindow in the main page to refresh it (once again, the refresh itself depends on the browser):
<telerik:RadWindow runat="server" ID="RadWindow_editor" OnClientClose="refreshMyPage"></telerik:RadWindow>
function refreshMyPage() {
    window.location.reload();
}




If you are going to change the URL of the main page to avoid re-initiating postbacks you may want to add a querystring with a random value e.g.:
window.location = "myPage.aspx?someParam=" + Math.random();


Regards,
Marin Bratanov
Telerik
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 the blog feed now.
Tags
Window
Asked by
Wiktor
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or