Disabling Embedded Resources for RadMenu|Navigation in Sitefinity 4.x
I spent quite a bit of time trying to figure out how to stop the navigation control from rendering the embedded CSS files that were causing havoc with my design. After much searching, reading, trials, etc. I discovered a few things that I hope will save someone else some time:
1. Mapping a custom template to the navigation widget and setting the EnableEmbeddedSkins and EnableEmbeddedBaseStylesheet to false does NOT produce the results you would think. For some reason the stylesheets are still pushed out to the site
2. To remove the stylesheets properly add the following lines to your web.config file:
1.
<!-- Disables the embedded skins for Navigation instances -->
2.
<
add
key
=
"Telerik.Navigation.EnableEmbeddedSkins"
value
=
"false"
/>
3.
<
add
key
=
"Telerik.Navigation.EnableEmbeddedBaseStylesheet"
value
=
"false"
/>
And the stylesheets are back! Sorry guys, not sure what happened, but for the briefest of moments the stylesheets were in fact gone, but now they're back again. I checked and the 2 app settings are still present as in :
<
add
key
=
"Telerik.Navigation.EnableEmbeddedSkins"
value
=
"false"
/>
<
add
key
=
"Telerik.Navigation.EnableEmbeddedBaseStylesheet"
value
=
"false"
/>
Hi Jacques,
Actually, disabling embedded scripts, in order to remove part of them, isn't a good idea, because then you'd have to add the disabled JavaScript resources from an external location. Please review this article in the RadControls documentation: http://www.telerik.com/help/aspnet-ajax/introduction-disabling-embedded-resources.html. If you disable the base scripts and you do not provide them manually you risk breaking the controls and all the client side functionality of this page, which is what happened in your case. It does not seem reasonable making customers add the scripts by themselves. However, if you decide to disable scripts and styles anyway, I would advise you to use the RadControls and create an external template for your Navigation. You can create a RadRabStrip, RadMenu, PanelBar, RadTreeView navigations set and configure in their declarations EnableEmbeddedSkins and EnableEmbeddedScripts to false and add all requires scripts manually, as shown in the above article.
Regards,
Boyan Barnev
the Telerik team
Hi Boyan,
I'm not sure if you noticed, but I only disabled the embedded skins and stylesheets, not the scripts, even though the article that you included a link for suggests doing that.
That however is not the problem I'm experiencing. The scripts I want in, but I don't want Telerik's styling (CSS) to be loaded.
Also you mention "...configure in their declarations EnableEmbeddedSkin..."... this doesn't work. You have to do it in the web.config, but even then it's not consistent.
Regards,
Jacques
Hi Jacques,
Thank you for getting back to me. Actually if you create an external template and explicitly set
EnableEmbeddedScripts to false and also apply your custom skin where you've declared custom styles, the default ones should not load. For example on creating custom skin for the Navigation widget in Sitefinity please check this article.