How it works?
The EJ resources and dependent scripts are encapsulated as embedded in our assembly and registered those resources in ASP Script Manager. Afterwards ASP Script Manager will take appropriate process to access the resources from assembly as usual once components gets loaded on that page.
For themes, necessary stylesheets will be added in the header section of current page dynamically to render the EJ components. To get the embed resources in your application, you should register an App Key in Web.Config file.
Access Embedded Resources
When drag and drop the control from toolbox to web page at the design time, the following key settings will be configured in web.config file. Refer to the following code snippet:
<appSettings> <add key="LoadEJResourcesFromAssembly" value="true" /> <add key="EJResources" value="jsrender:true;jqueryeasing:true; themes:true;" /> </appSettings>
The above key setting will be configured automatically when drag and drop the control in design page only, otherwise we should configure it manually in web.config file.
The key denotes that whether the resources are referred from assembly or not. If you do not want to load the resources from assembly, you can disable this key value. Refer to the following code snippet:
<appSettings> <add key="LoadEJResourcesFromAssembly" value="false" /> </appSettings>
EJResources key is used to get external scripts and themes that you want to access from assembly. For example, if you do not want to load the themes from assembly then you can give false to themes in that key. Refer to the following code snippet:
<appSettings> <add key="LoadEJResourcesFromAssembly" value="true" /> <add key="EJResources" value="jsrender:true;jqueryeasing:true;themes:false;" /> </appSettings>
- You should enable the ‘LoadEJResourcesFromAssembly’ key before configuring necessary scripts and themes in EJResources settings.
- The jQuery file is excluded from embedded resources list since while creating new project, jQuery script will be referred by default.
What are the resources will embed from assembly?
By default, the following resources are shipped as embedded resources from assembly.
- JsRender v1.0.0 Beta
- jQuery Easing v1.3
- Default Theme (Azure Flat)
And component related scripts will be embedded dynamically from assembly in your application.
The jquery.easing.js library already avails within ej.web.all.min.js file, therefore it is not necessary to externally refer it in your application if you have referred ej.web.all.min.js already. For version lower than 184.108.40.206, refer to the jQuery.easing.min.js along with the ej.web.all.min.js.
CDN integration with Embedded Resources
You can get these embedded resources from CDN (Content Delivery Networks) also. To achieve this behavior you should enable the EnableCdn property in ASP script manager control. Refer to the following code snippet:
<asp:scriptmanager id="ScriptManager1" runat="server" EnableCdn="true"> </asp:scriptmanager>
You can embed the resources from assembly when CDN (Content Delivery Network) is unavailable. To achieve this behavior you should enable EnableCdnFallback property in script manager. Refer to the following code snippet:
<asp:ScriptManager runat="server" EnableCdn="true" EnableCdnFallback="true"> </asp:scriptmanager>
- EnableCdnFallback property is supported from 4.5 and above frameworks.
- EnableCdnFallback is not applicable for theme file.
- Both script and style resources can also be accessed through HTTPS (secure connection) from CDN.