TClientScript
API Manual
Including Bundled Javascript Libraries in Prado
TClientScript allows Javascript code to be insert or linked to the
page template. PRADO is bundled with a large library of Javascript functionality
including effects, AJAX, basic event handlers, and many others. The bundled
Javascript libraries can be linked to the current page template using the
PradoScripts property. Multiple bundled Javascript libraries
can be specified using comma delimited string of the name of Javascript library
to include on the page. For following example will include the "ajax" and "effects" library.
<com:TClientScript PradoScripts="ajax, effects" />
The available bundled libraries included in Prado are
- prado : basic prado javascript framework based on jQuery
- effects : visual effects from jQuery
- ajax : ajax and callback related based on jQuery
- validator : validation
- logger : javascript logger and object browser
- datepicker : datepicker
- colorpicker : colorpicker
Many of the libraries, such as validator and datepicker will automatically
when controls that uses these libraries are visible on the page. For example, all the
validators
if they have their EnableClientScript set to true will include both the prado
and validator javascript libraries.
The dependencies for each library are automatically resolved. That is,
specifying, say the "ajax", will also include the "prado" library.
Including Custom Javascript Files
Custom Javascript files can be register using the ScriptUrl property.
The following example includes the Javascript file "test.js" to the page. In this case, the file
"test.js" is relative the current template you are using. Since the property value is
dynamic asset tag, the file "test.js" will be published
automatically, that is, the file will be copied to the assets directory if necessary.
<com:TClientScript ScriptUrl=<%~ test.js %> />
You can include Javascript files from other servers by specifying the full URL string in
the ScriptUrl property.
Including Custom Javascript Code Blocks
Any content within the TClientScript control tag will be considered as
Javascript code and will be rendered where it is declared.