If you use the client library only you'll need to ensure that you load the script library into your pages. Loading is available in a number of ways:
-
Automatic
If you're using any of the AJAX controls, they will - by default - load any required scripts automatically. All AJAX controls have a ScriptLocation and JQueryScriptLocation property which is set to WebResource by default which auto load scripts and other resources. These can be manually overridden with blank to specify no load at all or a specific path. -
ControlResources.LoadjQuery(), ControlResources.LoadjQueryUi() and ControlResources.LoadwwjQuery()
These methods can be used to force jQuery and ww.jquery.js to be loaded into the page under program control. By default these libraries are loaded into the top of the header and bottom of the header respectively. The libraries are loaded from resources and automatically GZip compressed when debug mode is off. -
Manual
Of course you can also still manually load scripts by manually adding them to the HTML header. The disadvantage of this approach is that you have to manage scripts completely on your own to avoid potential duplicate scripts from loading. You can do that with all of the AJAX controls, but there's an easier way using the ScriptContainer control. -
ScriptContainer Control
The ScriptContainer control provides a way to register scripts in a page in a central location in much the same ways as you do in the HTML header. The advantage of this control is that it that the scripts are managed and tracked so duplication is minimized. Scripts can be loaded in differently locations of the document (HeaderTop,Header,Inline) and can automatically be switched between release and debug versions. The control can also programmatically controlled and the biggest advantage of this control is that it can track scripts loaded to avoid duplicate script loads. -
ClientScriptProxy Component
The ScriptContainer uses the ClientScriptProxy control under the hood to load individual scripts and you can also use this control yourself using RegisterClientScriptInclude or RegisterClientScriptResource. ClientScriptProxy is a wrapper for Page.ClientScript and ScriptManager and provides a consistent interface to load scripts into a page at a low level.
See also
Loading jQuery and jQuery UI from a Content Delivery Network© West Wind Technologies, 1996-2016 • Updated: 12/19/15
Comment or report problem with topic