| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
class Home extends TPage
|
|
|
4 |
{
|
|
|
5 |
public function onLoad($param)
|
|
|
6 |
{
|
|
|
7 |
parent::onLoad($param);
|
|
|
8 |
if(!$this->IsPostBack)
|
|
|
9 |
{
|
|
|
10 |
$data=array('item 1','item 2','item 3','item 4');
|
|
|
11 |
$this->DBListBox1->DataSource=$data;
|
|
|
12 |
$this->DBListBox1->dataBind();
|
|
|
13 |
|
|
|
14 |
$data=array('key 1'=>'item 1','key 2'=>'item 2',
|
|
|
15 |
'key 3'=>'item 3','key 4'=>'item 4');
|
|
|
16 |
$this->DBListBox2->DataSource=$data;
|
|
|
17 |
$this->DBListBox2->dataBind();
|
|
|
18 |
|
|
|
19 |
$data=array(
|
|
|
20 |
array('id'=>'001','name'=>'John','age'=>31),
|
|
|
21 |
array('id'=>'002','name'=>'Mary','age'=>30),
|
|
|
22 |
array('id'=>'003','name'=>'Cary','age'=>20));
|
|
|
23 |
$this->DBListBox3->DataSource=$data;
|
|
|
24 |
$this->DBListBox3->dataBind();
|
|
|
25 |
}
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
public function DBListBox1Changed($sender,$param)
|
|
|
29 |
{
|
|
|
30 |
$this->collectSelectionResult($sender,$this->DBListBox1Result);
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
public function DBListBox2Changed($sender,$param)
|
|
|
34 |
{
|
|
|
35 |
$this->collectSelectionResult($sender,$this->DBListBox2Result);
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
public function DBListBox3Changed($sender,$param)
|
|
|
39 |
{
|
|
|
40 |
$this->collectSelectionResult($sender,$this->DBListBox3Result);
|
|
|
41 |
}
|
|
|
42 |
|
|
|
43 |
protected function collectSelectionResult($input,$output)
|
|
|
44 |
{
|
|
|
45 |
$indices=$input->SelectedIndices;
|
|
|
46 |
$result='';
|
|
|
47 |
foreach($indices as $index)
|
|
|
48 |
{
|
|
|
49 |
$item=$input->Items[$index];
|
|
|
50 |
$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
|
|
|
51 |
}
|
|
|
52 |
if($result==='')
|
|
|
53 |
$output->Text='Your selection is empty.';
|
|
|
54 |
else
|
|
|
55 |
$output->Text='Your selection is: '.$result;
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
public function selectionChanged($sender,$param)
|
|
|
59 |
{
|
|
|
60 |
$this->collectSelectionResult($sender,$this->SelectionResult);
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
public function buttonClicked($sender,$param)
|
|
|
64 |
{
|
|
|
65 |
$this->collectSelectionResult($this->ListBox1,$this->SelectionResult2);
|
|
|
66 |
}
|
|
|
67 |
|
|
|
68 |
public function multiSelectionChanged($sender,$param)
|
|
|
69 |
{
|
|
|
70 |
$this->collectSelectionResult($sender,$this->MultiSelectionResult);
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
public function buttonClicked2($sender,$param)
|
|
|
74 |
{
|
|
|
75 |
$this->collectSelectionResult($this->ListBox2,$this->MultiSelectionResult2);
|
|
|
76 |
}
|
|
|
77 |
}
|
|
|
78 |
|
|
|
79 |
?>
|