summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/Controls/ClientScript.page
blob: 5be3863c1b7bd107db9967dafdcebae90460f9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<com:TContent ID="body" >

<h1 id="2201">TClientScript</h1>
<com:DocLink ClassPath="System.Web.UI.WebControls.TClientScript" />
<h2 id="2202">Including Bundled Javascript Libraries in Prado</h2>
<p id="260238" class="block-content">
<tt>TClientScript</tt> 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
<tt>PradoScripts</tt> 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.
</p>
<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_260101">
&lt;com:TClientScript PradoScripts="ajax, effects" /&gt;
</com:TTextHighlighter>

<p id="260239" class="block-content">
	The available bundled libraries included in Prado are</p>
	<ul id="u1" class="block-content">
	    <li><tt>prado</tt> : basic prado javascript framework based on Prototype</li>
	    <li><tt>effects</tt> : visual effects from script.aculo.us</li>
	    <li><tt>ajax</tt> : ajax and callback related based on Prototype</li>
	    <li><tt>validator</tt> : validation</li>
	    <li><tt>logger</tt> : javascript logger and object browser</li>
	    <li><tt>datepicker</tt> : datepicker</li>
	    <li><tt>colorpicker</tt> : colorpicker</li>
	</ul>
<p id="260240" class="block-content">
Many of the libraries, such as <tt>validator</tt> and <tt>datepicker</tt> will automatically
when controls that uses these libraries are visible on the page. For example, all the 
<a href="?page=Controls.Validation">validators</a>
if they have their <tt>EnableClientScript</tt> set to true will include both the <tt>prado</tt> 
and <tt>validator</tt> javascript libraries. 
The dependencies for each library are automatically resolved. That is,
	specifying, say the "ajax", will also include the "prado" library.</p>

<h2 id="2203">Including Custom Javascript Files</h2>
<p id="260241" class="block-content">Custom Javascript files can be register using the <tt>ScriptUrl</tt> 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
<a href="?page=Configurations.Templates3">dynamic asset tag</a>, the file "test.js" will be published
automatically, that is, the file will be copied to the assets directory if necessary.
</p>
<com:TTextHighlighter Language="prado" CssClass="source block-content" id="code_260102">
&lt;com:TClientScript ScriptUrl=&lt;%~ test.js %&gt; /&gt;
</com:TTextHighlighter>
<p id="260242" class="block-content">You can include Javascript files from other servers by specifying the full URL string in
	the <tt>ScriptUrl</tt> property.</p>

<h2 id="2204">Including Custom Javascript Code Blocks</h2>
<p id="260243" class="block-content"> Any content within the <tt>TClientScript</tt> control tag will be considered as
	Javascript code and will be rendered where it is declared.</p>

<div class="last-modified">$Id$</div></com:TContent>