Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
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->DBCheckBoxList1->DataSource=$data;
12
			$this->DBCheckBoxList1->dataBind();
13
 
14
			$data=array('key 1'=>'item 1','key 2'=>'item 2',
15
						'key 3'=>'item 3','key 4'=>'item 4');
16
			$this->DBCheckBoxList2->DataSource=$data;
17
			$this->DBCheckBoxList2->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->DBCheckBoxList3->DataSource=$data;
24
			$this->DBCheckBoxList3->dataBind();
25
		}
26
	}
27
 
28
	protected function collectSelectionResult($input,$output)
29
	{
30
		$indices=$input->SelectedIndices;
31
		$result='';
32
		foreach($indices as $index)
33
		{
34
			$item=$input->Items[$index];
35
			$result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
36
		}
37
		if($result==='')
38
			$output->Text='Your selection is empty.';
39
		else
40
			$output->Text='Your selection is: '.$result;
41
	}
42
 
43
	public function buttonClicked($sender,$param)
44
	{
45
		$this->collectSelectionResult($this->CheckBoxList,$this->SelectionResult);
46
	}
47
 
48
	public function selectionChanged($sender,$param)
49
	{
50
		$this->collectSelectionResult($sender,$this->SelectionResult2);
51
	}
52
 
53
	public function DBCheckBoxList1Changed($sender,$param)
54
	{
55
		$this->collectSelectionResult($sender,$this->DBCheckBoxList1Result);
56
	}
57
 
58
	public function DBCheckBoxList2Changed($sender,$param)
59
	{
60
		$this->collectSelectionResult($sender,$this->DBCheckBoxList2Result);
61
	}
62
 
63
	public function DBCheckBoxList3Changed($sender,$param)
64
	{
65
		$this->collectSelectionResult($sender,$this->DBCheckBoxList3Result);
66
	}
67
 
68
}
69
 
70
?>