App
#2 Use PageService.Activate Features like JS/CSS
Use PageService.Activate Features like JS/CSS
2sxc 12.04 helps with many advanced challenges like these:
- Make sure that certain scripts are only loaded once (like jQuery or FancyBox)
- Make sure that all apps use the same version of these scripts
- Starting things in the right order
The samples can differ based on your Razor base class or if you're running an old version.
Selected: Typed (2sxc 16+) Switch to Dynamic (Razor14 or below)
Selected: Typed (2sxc 16+) Switch to Dynamic (Razor14 or below)
Activate Feature with the Page.Activate (IPageService)
The following example will tell the page that fancybox4
is required - which will automatically apply a lightbox to the image below.
It uses the WebResources
as configured in the Settings. By default, fancybox4 is already defined, but you can overide this or create your own WebResource definitions.
#2 Use PageService.Activate Features like JS/CSS