blob: 6be81e9649b1a35429e653b2016a8f1fe83c700b (
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
57
|
<com:TContent ID="body">
<h1>TCallback Samples</h1>
<table class="sampletable">
<tr><td class="samplenote">
An active label text being set as the result of a callback:
</td><td class="sampleaction">
<com:TCallback ID="callback1" OnCallback="callback1_Requested" />
<script type="text/javascript">
function do_callback1()
{
var request = <%= $this->callback1->ActiveControl->Javascript %>;
request.dispatch();
}
</script>
<div onclick="do_callback1()" style="background-color:red;border: 1px solid black">Click Me!</div>
<br/><com:TActiveLabel Text="This is a label" ID="label1"
/>
<br/><com:TActiveButton
Text="reset example"
OnClick="buttonClicked"
/>
</td></tr>
<tr><td class="samplenote">
A TCallback with a 3-items array as parameter.
The first parameter is defined in the onclick() attribute of the red div;
The second parameter is defined in the body of the javascript function;
The third parameter is taken from the textbox;
</td><td class="sampleaction">
<com:TCallback ID="callback2" OnCallback="callback2_Requested" />
<script type="text/javascript">
function do_callback2(param1)
{
var request = <%= $this->callback2->ActiveControl->Javascript %>;
var param2 = 'value 2';
var param3 = $('#<%= $this->txt1->ClientID %>').val();
request.setCallbackParameter({'Param1':param1, 'Param2':param2, 'Param3':param3});
request.dispatch();
}
</script>
TextBox for third parameter: <com:TTextBox ID="txt1" text="value 3"/>
<div onclick="do_callback2('value 1')" style="background-color:red;border: 1px solid black">Click Me!</div>
<br/>Parameter 1 is <com:TActiveLabel Text="" ID="labelParam1" />
<br/>Parameter 2 is <com:TActiveLabel Text="" ID="labelParam2" />
<br/>Parameter 3 is <com:TActiveLabel Text="" ID="labelParam3" />
</td></tr>
</table>
</com:TContent>
|