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

Disable Template Manager Caching

3 Answers 118 Views
Editor
This is a migrated thread and some comments may be shown as answers.
CBARS
Top achievements
Rank 2
CBARS asked on 11 Mar 2009, 09:12 AM
How do I disable Template Manager from caching the files?

I added a save button in RadEditor, but Template Manager keeps reading the original file. Whenever I clear FF's cache, Template Manager inserts the correct files.

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Mar 2009, 08:31 AM
Hi Marcel,

The caching is not related to the editor's template manager but to the browser caching mechanism.
You can try to prevent the caching by using the instructions in these articles:
How to prevent Firefox 3 from caching,
How to prevent caching in Internet Explorer
and
Useful HTML Meta Tags.

Best regards,
Rumen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
John
Top achievements
Rank 1
answered on 26 Jul 2009, 01:53 AM
I think the instructions may work for pages, but not for the Editor template manager.
I had following codes:
protected void linkSaveCss_Click(object sender, EventArgs e)   
{  
    if (SaveCssToFile(cssZone.Text, Server.MapPath(hdnCssFilePath.Value)) == true)   
    {  
        //editor.CssFiles.Clear();   
        //editor.CssFiles.Add(new EditorCssFile(string.Format("{0}?t={1}", hdnCssFilePath.Value, DateTime.Now.Ticks.ToString())));  
        Response.Buffer = false;     
        Response.ExpiresAbsolute = DateTime.MinValue;  
        Response.CacheControl = "no-cache";  
        Response.AddHeader("Pragma""no-cache");  
        Response.Expires = -1;  
        Response.Redirect(Request.Url.ToString());  
     }    
     else    
        header1.AlertMessage("Failed to save the CSS file. ");    

And I still get the cached style in both the editor and the template manager.
0
Lini
Telerik team
answered on 29 Jul 2009, 11:49 AM
Hi John,

To disable the caching of the files loaded in the template manager dialog, you will need to make a small modification to the dialog code. In order to do it, you need to use the ExternalDialogsPath editor property to load the template manager from an external .ascx file. For an example of this, see the following editor demo - http://demos.telerik.com/aspnet-ajax/editor/examples/externaldialogspath/defaultcs.aspx.

Once you have set up the TemplateManager.ascx as an external dialog, change the setItem JavaScript function to the following:

setItem: function(item) 
    this._currentItem = item; 
    if (this._currentItem.get_type() == Telerik.Web.UI.FileExplorerItemType.File) 
    { 
        var url = this._currentItem.get_url(); 
        if (url) 
        { 
            url = url + (url.indexOf('?') != -1 ? "&" : "?") + "rndnum=" + (new Date() - 100); 
            this._currentTemplateItem.src = url; 
        } 
    } 
    else 
    { 
        this._currentTemplateItem.src = "javascript:''"
    } 
}, 

This will force the template manager to use a different url for the template files each time you select them in the file browser. The benefit of the change is of course that the files will no longer be loaded from the browser cache. However, we do not plan to include this change in the editor code, because it also slows down the loading time for each file considerably. Since you need to make a request to the server each time you click on a file, some scenarios will (e.g. distant server, big template files) will suffer if caching is removed.


Regards,
Lini
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Editor
Asked by
CBARS
Top achievements
Rank 2
Answers by
Rumen
Telerik team
John
Top achievements
Rank 1
Lini
Telerik team
Share this question
or