Child page browser reload message

4 posts, 0 answers
  1. Kashif Imran
    Kashif Imran avatar
    29 posts
    Member since:
    Apr 2009

    Posted 11 Apr 2010 Link to this post

    Hi,

    I am using RadWindow to show details of an item. I have image on parent page and using onclick I call the javascript function below. Image is added to the page in code behind like this:

    sb.Append(string.Format("<img title=\"Details\" src=\"images/details.png\" onclick=\"ShowWindow('SessionDetails.aspx?id={0}');return false;\"/>&nbsp;", pid));

     

     var oldUrl;
            function ShowWindow(url) {
                var oWnd = $find("<%=rwDialog.ClientID%>");
                oWnd.setUrl(url);
                oWnd.setSize(750, 480);
                oWnd.show();
                if (oldUrl == url) {
                    oWnd.reload();
                }
                oldUrl = url;
            }

    If I click on image to see details, it works fine. Now if I click on the same item again (without clicking any other item), it show window with the same page but without post back. Thats why I used oldUrl in script above. If page is different from last click, it only sets the url. But I used clicked on the same item, reload will give them fresh page. Problem is that that it gives browser message that page will reload.

    Another thing I noticed is that it happens only if I use a close button in my child page. If I use RadWindow's default close button to close the window, I dont get that reload warning. Any ideas how can i avoid that reload message?

    This is how I close child window

    private void CloseWithoutParentRefresh()
        {
            string script = string.Format("<script>CloseOnReload()</" + "script>");
            ClientScript.RegisterStartupScript(this.GetType(), "CloseOnReload", script);
        }

      //GetRadWindow obtains a reference to the hosting RadWindow"
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }
            function CloseOnReload(url) {
                GetRadWindow().close();
            }

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 14 Apr 2010 Link to this post

    Hi Kashif,

    The reason for the message is that you are making a postback and after that you call reload() which is the equivalent of pressing the F5 key on the content page. In such case (when there was a postback before that) you would always get a warning about sending POSTDATA again - this is the browser's default behavior.

    What I would suggest is not to call reload() but to load the content page again.
    e.g.
    oWnd.setUrl(oWnd.get_navigateUrl());


    Greetings,
    Georgi Tunev
    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. Kashif Imran
    Kashif Imran avatar
    29 posts
    Member since:
    Apr 2009

    Posted 14 Apr 2010 Link to this post

    Hi Georgi,

    Thanks for your reply. I am calling reload because if RadWindow is set to same url it loads the old page and does not bring the new page. Below are some details

    I have a details button next to each product. When user click on that button, I set url to Details.aspx?productId=xyz. Next time users click on different product and it goes to Details.aspx?productId=abc.

    But if user close the windows and click on the same details button again, and if product details have changed in between, radwindow still shows the older page. I have Response.Write(DateTime.Now); in page load. And I can see if I click on a product detail I get a timestamp in child window. If I close window and click on same details button again, you will see timestap wont change. Shwoing that it show the page from cache and not the one from server.

    Currently I am setting windows url onclose to a blank.aspx. This way I dont have to call reload and avoid both the issues. I get new page each time I show window and no reload error. But this is just a hack. I hope you can come up with better solution.

  4. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 19 Apr 2010 Link to this post

    Hi Kashif,

    If you are using RadWindowManager, I would suggest to set ReloadOnShow=true and ShowContentDuringLoad=false - this setup should take care of the dialog's caching. Another option is to set DestroyOnClose=true, but in this case you again will need RadWindowManager.
    If you are using standalone RadWindow however, the only approach is the one that you have currently used - to manually change the Url when the window is closed.

    Greetings,
    Georgi Tunev
    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.
Back to Top