aspnet-403716-common-concepts-performance-optimization-built-in-options-for-resource-optimization.md
This topic summarizes the built-in resource optimization options available in DevExpress ASP.NET Web Forms controls.
DevExpress ASP.NET Web Forms controls use the DevExpress HTTP Handler/Module (ASPxHttpHandlerModule) to efficiently serve resources. DevExpress resources, such as JavaScript, CSS, and image files, are embedded in control-related assemblies. The ASPxHttpHandlerModule retrieves the required resources from assemblies and uses a specific .axd file – DXR.axd – to inject resources into a client-side web page.
You can use a set of DevExpress Web.config options to affect how the ASPxHttpHandlerModule forms responses, optimizes resources, and improves the page load. It is recommended to combine all available optimization options to achieve better performance.
Any response not natively compressed (such as JavaScript, CSS, or HTML) can benefit from response compression. The DevExpress configuration options allow you to set up resource compression and reduce the web page load time.
To minimize the size of response data, use the following options in Web.config:
Enable the following configuration option to reduce the size of the built-in resource files (JavaScript and CSS):
If you enable IIS compression on the web server, it is recommended that you disable the DevExpress compression-related configuration options (mentioned above) to avoid incorrect behavior.
Note that the DevExpress ASP.NET Web Forms controls do not support the use of external minification tools to optimize the built-in resources. A DevExpress client-side API cannot be minified or obfuscated, because minification usually shortens API names and might make the client API work incorrectly.
To minify DevExpress resources, use the DevExpress built-in optimization mechanism described in this topic.
You can improve web page performance by reducing the number of requests served to the server for resources.
Use the following configuration option to minimize the number of requests to the server for the resource files embedded into DevExpress assemblies:
If your application contains custom script and stylesheet files, you can merge these resources in a similar manner with the help of the DevExpress built-in mechanism.
Refer to the following topic to learn more:
How to: Merge and Compress Custom CSS and JavaScript Files.
DevExpress ASP.NET Web Forms controls contain specific resource management components and a configuration option to specify embedded or external resources to load.
You can use the ASPxScriptManager and ASPxStyleSheetManager components to reference control-specific or suite-specific script and stylesheet resources. This allows you to manually manage what resources to load and specify their position and required order within a web page.
The following code snippet demonstrates how to reference scripts and stylesheets for the required suite (NavigationAndLayout). The page contains two web controls from this suite (ASPxMenu and ASPxNavBar).
<html ...>
<head runat="server">
...
<dx:ASPxStyleSheetManager ID="ASPxStyleSheetManager1" runat="server">
<Items>
<dx:StyleSheet Suite="NavigationAndLayout" />
</Items>
</dx:ASPxStyleSheetManager>
<dx:ASPxScriptManager ID="ASPxScriptManager1" runat="server">
<Items>
<dx:Script Suite="NavigationAndLayout" />
</Items>
</dx:ASPxScriptManager>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxMenu ...>
</dx:ASPxMenu>
</div>
<div>
<dx:ASPxNavBar ...>
</dx:ASPxNavBar>
</div>
</form>
</body>
</html>
The code below references script and stylesheet files for an individual web control (ASPxMenu).
<html ...>
<head runat="server">
...
<dx:ASPxStyleSheetManager ID="ASPxStyleSheetManager1" runat="server">
<Items>
<dx:StyleSheet Control="ASPxMenu" />
</Items>
</dx:ASPxStyleSheetManager>
<dx:ASPxScriptManager ID="ASPxScriptManager1" runat="server">
<Items>
<dx:Script Control="ASPxMenu" />
</Items>
</dx:ASPxScriptManager>
</head>
<body>
<form id="form1" runat="server">
<div>
<dx:ASPxMenu ...>
</dx:ASPxMenu>
</div>
</form>
</body>
</html>
With the following configuration option, you can control which external client-side script library to reference and automatically load to the browser:
To avoid the automatic load of any libraries, declare an empty resources section and manually attach DevExtreme resources and the necessary third-party libraries (such as jQuery) to the web pages in which they are required.
See Also