RadControls for ASP.NET AJAX
By default each of RadControls for ASP.NET Ajax serves a set of files (JS code) needed for its proper client-side operation.
When loading a page with several controls on it, the number of these files can become very large, often resulting in a reduced page load time and increased traffic. The reason for this problem is that browsers make a separate request to the server for each of these resources.
Usually this problem is overcome by disabling the automatic script serving of the controls, combining them into a smaller set of files and registering the links to these files manually on the page.
This approach is not the best for of a number of reasons:- you must extract the files from the assembly for each control release;- files become too large to be maintainable (or you have to write a script to merge the source files);- the number of merged files you need to maintain can become very large depending on the control sets you have on different pages;
The performance gain of RadScriptManager should be monitored on a remote server, but not in a local development. This is, because the control optimizes the network latency delay when loading the scripts. This comes at the cost of some processor load, because the scripts get combined and compressed on the server.
When testing locally, the largest part of the result you get is the time RadScriptManager takes to combine the scripts and serve them to the browser.
Note that the RadScriptManager does NOT combine the web resources needed for the Telerik controls in a single request when the CDN is enabled.
RadScriptManager needs an HttpHandler to be declared in the application configuration file to operate properly. The addition of the handler is made easy by the SmartTags of the control:
RadScriptManager is a control that replaces the ScriptManager available in the Microsoft Ajax Extensions suite.
The way RadScriptManager operates is outputting a <script> tag with a specific URL, making a request to an HttpHandler, which serves the combined scripts.
If the script combination is not needed for some reason (e.g. debugging) it can be disabled by giving the EnableScriptCombine property the value of false.
The Handler can be changed by using the HttpHandlerUrl property of the control.
Registering the HttpHandler for web sites running on IIS 5.0, 5.1 and 6.0:
<add path="Telerik.Web.UI.WebResource.axd" verb="*" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" validate="false" />
Registering the HttpHandler for web sites running on IIS7:
When in Integrated mode, IIS7 reads the application configuration from the <system.webServer> section group in the application configuration file, but not the <system.web> section group. Since Visual Studio 2005 does not provide "native" support for IIS7, the RadScriptManager registration cannot be automatically added to the system.webServer.
There are two cases:
Limitations of the control:
RadScriptManager ignores ScriptReferences to scripts embedded in an assembly, but pointed to a script file by using the Path property, e.g.
<telerik:RadScriptManager ID="”RadScriptManager1”" runat="”server”">
<asp:ScriptReference Name="MyNamespace.MyFile.js" Assembly="MyAsembly" Path="/MyVirtualLocation/MyFile.js">
RadScriptManager does not support the automatic switch to debug-mode, e.g. Having an assembly including ScriptReferences in both Debug and Release ScriptMode, where the application is in a debug mode, RadScriptManager will output only the "Release" ones. If debugging is needed, the EnableScriptCombine property can be set to false.
RadScriptManager currently does not display Intellisense information for the <Scripts> property and the ScriptReferences.