Suppose you need to cache a user control which has a RadMenu control in it.
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Menu.ascx.cs" Inherits="Menu" %>
<%@ OutputCache Duration="10" VaryByParam="None" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadMenu ID="RadMenu1" runat="server">
After a postback the menu will lose reference to its scripts and css styles. Here is a screenshot of a typical case when this happens after postback:
The reason for this is that when the aspx page postbacks, it receives the cached output which doesn't contain registration for the css styles and script
files of the control.
SOLUTION
The solution is to manually register the skin and the java script files.
Part I - Registering the css styles
<head runat="server">
<link href="~/Skins/Menu.css" rel="stylesheet" type="text/css" />
<link href="~/Skins/Default/Menu.Default.css" rel="stylesheet" type="text/css" />
</head>
Part II - Registering the scripts
3. Register th scripts with a script manager like this:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference NotifyScriptLoaded="true" Assembly="Telerik.Web.UI"
Name="Telerik.Web.UI.Common.Core.js" Path="~/Scripts/Common/Core.js" />
<asp:ScriptReference NotifyScriptLoaded="true" Assembly="Telerik.Web.UI"
Name="Telerik.Web.UI.Common.Animation.AnimationScripts.js" Path="~/Scripts/Common/Animation/AnimationScripts.js" />
<asp:ScriptReference NotifyScriptLoaded="true" Assembly="Telerik.Web.UI"
Name="Telerik.Web.UI.Common.Navigation.NavigationScripts.js" Path="~/Scripts/Common/Navigation/NavigationScripts.js" />
<asp:ScriptReference NotifyScriptLoaded="true" Assembly="Telerik.Web.UI"
Name="Telerik.Web.UI.Menu.RadMenuScripts.js" Path="~/Scripts/Menu/RadMenuScripts.js" />
</Scripts>
</asp:ScriptManager> ...