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

2 posts, 0 answers
  1. Wiktor
    Wiktor avatar
    2 posts
    Member since:
    Aug 2013

    Posted 02 Dec 2013 Link to this post

    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!

  2. Marin Bratanov
    Admin
    Marin Bratanov avatar
    3595 posts

    Posted 02 Dec 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top