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

DestroyOnClose still caches - with example!

5 Answers 185 Views
Window
This is a migrated thread and some comments may be shown as answers.
Steele
Top achievements
Rank 1
Steele asked on 05 Jan 2011, 02:11 AM
Hi All,
DestroyOnClose seems to be one of those topics that reoccurs but never really gets resolved.
I am suffering from the continued caching problem regardless of the DestroyOnClose variable. The thing that has ended most other threads on this has been a Telerik support person being unable to replicate or asking for an example. So I have done one up. The simplest I can think of.  Since I cannot attach the project here, please see the code below.
Using this example :
  1. Start the solution using MainPage as the start page
  2. Click on the Launch1 button
  3. A modal popup window will appear, with the string "Launch1" on the second line - as expected.
  4. Close the window.
  5. Now click on the Launch2 button.
  6. The modal reappears, bearing the same content - is should say "Launch2" in the text.

I am using 2010.3.1109.40 version of the Telerik.Web.UI.

Please help me out with this.
Thanks,
Steele.

MainPage.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MainPage.aspx.cs" Inherits="TestTelerikWebApp.MainPage" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="buttLaunch1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="buttLaunch1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="buttLaunch2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="buttLaunch2" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" 
        DestroyOnClose="True">
    </telerik:RadWindowManager>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function OpenMyWindow() {
            var oManager = null;
            if (typeof (GetRadWindowManager) == 'function') // there is a radwindowmanager in scope, so use it
                oManager = GetRadWindowManager();
  
            var oWnd = oManager.open('TestPopup.aspx', 'This is a test');
        }
    </script>
    </telerik:RadCodeBlock>
    <div>
      
        <asp:Button ID="buttLaunch1" runat="server" Text="Launch1" 
            onclick="buttLaunch1_Click" />
        <asp:Button ID="buttLaunch2" runat="server" Text="Launch2" 
            onclick="buttLaunch2_Click" />
      
    </div>
    </form>
</body>
</html>

MainPage.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace TestTelerikWebApp
{
    public partial class MainPage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
  
        }
  
        protected void buttLaunch1_Click(object sender, EventArgs e)
        {
            Session["ErrorInfo"] = "Launch1";
            RadAjaxManager1.ResponseScripts.Add("OpenMyWindow();");
        }
  
        protected void buttLaunch2_Click(object sender, EventArgs e)
        {
            Session["ErrorInfo"] = "Launch2";
            RadAjaxManager1.ResponseScripts.Add("OpenMyWindow();");
        }
    }
}

TestPopup.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestPopup.aspx.cs" Inherits="TestTelerikWebApp.TestPopup" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      
        I am a popup<br />
        <asp:Label ID="lblMessage" runat="server"></asp:Label>
      
    </div>
    </form>
</body>
</html>

TestPopup.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
  
namespace TestTelerikWebApp
{
    public partial class TestPopup : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Text = Session["ErrorInfo"].ToString();
        }
    }
}

5 Answers, 1 is accepted

Sort by
0
Steele
Top achievements
Rank 1
answered on 05 Jan 2011, 06:05 AM
Well, after a lot of investigations, I have found setting the property ReloadOnShow of the RadWindowManager to true gives me the behaviour that I am after.  My only concern is that I am not sure under what conditions this reload will occur (eg. does it occur when a window is restored?).
With this in mind, I am at a loss as to the usefullness of the DestroyOnClose property - though I have both now set to true.
I hope someone more Telerik advanced can fill in some of the blanks here for me.  A bit of a "when to use what" type thing around these properties. The doco seems a bit lacking in explanation.
Thanks,
Steele.
0
Georgi Tunev
Telerik team
answered on 05 Jan 2011, 12:34 PM
Hi Steele,

I tested your code and everything is working as expected on my side (movie attached). I believe that the reason for the problem on your side is the browser's cache. Could you please check if you have set the browser to check for new versions of the page "automatically" or "every time"?
I am asking this because IE has a nasty habit to cache pages opened in IFRAMEs (when displaying a content page, RadWindow uses an IFRAME and basically behaves just like one) - once the content page is loaded in the iframe, whenever you reload that page again, the browser takes the cached version.
That is why we added the ReloadOnShow property - it forces reload on the content page whenever the show() and it adds a custom, random query string to the content Url to ensure that the browser will always get the newest version of the page.
If you don't want to use that property, the alternative is to disable the cache in the content page. This can be done from the server / using meta tags / settings in the page's registration. More information on how to disable browsers' cache in a page are available in various places in the Net.


Best wishes,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Rhyss
Top achievements
Rank 1
answered on 06 Jan 2011, 12:36 AM
Hi Georgi,
Thanks for the explanation - I think it might be beneficial to have this info in the help doco, as I had a heck of a time in finding the solution.
On IE (I am using IE8) caching, I was unable to track down the option that you were refering to.  Do you know where this could be found?
The one thing I did realise from your video was the zone you ran in was Local Intranet Protected Mode off, where we always run in Internet Protected Mode on.  Not sure if that could have an impact.
Could you advise me of any impacts of using ReloadOnShow? It has not seemed to break any workflows for me from my testing, but I would like to know of things that I should be looking for.
Again, thanks for the info.
Steele.
0
Steele
Top achievements
Rank 1
answered on 06 Jan 2011, 01:08 AM
Sorry, wrong PC.
The above comment was from me.
Thanks,
Steele.
0
Georgi Tunev
Telerik team
answered on 06 Jan 2011, 03:36 PM
Hi Steele,

Go to Internet Options / Browsing History / Settings. I assume that in your case, the selected value is Automatically (which is the default setting). In such case however, the browser caches the content of the IFRAMEs. To avoid that, you should either change the browser's settings to "Every time I visit the webpage", or better (as you cannot do that change on all your client PCs) - to disable the cache in the content page by using one of the methods I mentioned in my previous reply. Of course, the third way is to use ReloadOnShow :)
I don't think that you will experience problems with this property. The only issue I can think of now is that when you use that property for a RadWindow that opens sites like Google for example, which will throw an error because of the added query string.


Greetings,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Window
Asked by
Steele
Top achievements
Rank 1
Answers by
Steele
Top achievements
Rank 1
Georgi Tunev
Telerik team
Rhyss
Top achievements
Rank 1
Share this question
or