summaryrefslogtreecommitdiff
path: root/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-06-02 16:06:37 +0000
committerctrlaltca@gmail.com <>2011-06-02 16:06:37 +0000
commit6394a6ffe3a9f3e4e698603b94503dc96f1e2652 (patch)
tree26dfde346742329d064d336936edf20fdb7cb81e /demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox
parentb9f9a16d7eefc48ac489c8cb2b87749459bb3d38 (diff)
upported documentation changes to trunk/
Diffstat (limited to 'demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox')
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.page108
-rw-r--r--demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php60
2 files changed, 168 insertions, 0 deletions
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.page b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.page
new file mode 100644
index 00000000..b23b644d
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.page
@@ -0,0 +1,108 @@
+<com:TContent ID="body">
+
+<h1>TActiveListBox Samples</h1>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Callback listbox:
+</td>
+<td class="sampleaction">
+<com:TActiveListBox
+ OnSelectedIndexChanged="selectionChanged">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" Selected="true" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TActiveListBox>
+<com:TActiveLabel ID="SelectionResult" ForeColor="red" />
+</td>
+</tr>
+
+</table>
+
+
+<h2>Changing items to a Listbox on callback</h2>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Adding an item on every callback:
+ </td>
+ <td class="sampleaction">
+ <com:TActiveListBox ID="box1" />
+ <com:TActiveButton ID="button1" Text="add a new item" OnCallback="buttonClicked" />
+ <com:TActiveLabel ID="label1" ForeColor="red" />
+ </td>
+</tr>
+
+</table>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Clearing / restoring the listbox on callback:
+ </td>
+ <td class="sampleaction">
+ <com:TActiveListBox ID="box2" />
+ <com:TActiveButton ID="button2" Text="clear" OnCallback="clearClicked" />
+ <com:TActiveButton ID="button3" Text="reset" OnCallback="resetClicked" />
+ <com:TActiveLabel ID="label2" ForeColor="red" />
+ </td>
+</tr>
+
+</table>
+
+<h2>List Boxes with Validation</h2>
+
+<table class="sampletable">
+
+<tr>
+<td class="samplenote">
+Listbox is being validated:
+</td>
+<td class="sampleaction">
+<com:TActiveListBox ID="VDropDownList1">
+ <com:TListItem Value="value 1" Text="item 1" />
+ <com:TListItem Value="value 2" Text="item 2" />
+ <com:TListItem Value="value 3" Text="item 3" />
+ <com:TListItem Value="value 4" Text="item 4" />
+</com:TActiveListBox>
+<com:TRequiredFieldValidator
+ ControlToValidate="VDropDownList1"
+ ErrorMessage="You must make a selection other than the first option"
+ InitialValue="value 1"
+ Display="Dynamic"
+ ValidationGroup="Group1"
+ />
+<com:TActiveButton Text="Submit" ValidationGroup="Group1" />
+</td>
+</tr>
+
+<tr>
+<td class="samplenote">
+Listbox causing validation:
+</td>
+<td class="sampleaction">
+<com:TTextBox ID="TextBox" />
+<com:TRequiredFieldValidator
+ ControlToValidate="TextBox"
+ ErrorMessage="You must enter a value"
+ Display="Dynamic"
+ ValidationGroup="Group2"
+ />
+<com:TActiveListBox
+ ID="VDropDownList2"
+ ValidationGroup="Group2">
+ <com:TListItem Text="Agree" />
+ <com:TListItem Text="Disagree" />
+</com:TActiveListBox>
+</td>
+</tr>
+
+</table>
+
+<div class="last-modified">$Id$</div></com:TContent> \ No newline at end of file
diff --git a/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php
new file mode 100644
index 00000000..5ec96613
--- /dev/null
+++ b/demos/quickstart/protected/pages/ActiveControls/Samples/TActiveListBox/Home.php
@@ -0,0 +1,60 @@
+<?php
+
+class Home extends TPage
+{
+ public function onLoad($param)
+ {
+ parent::onLoad($param);
+ if(!$this->IsPostBack && !$this->IsCallback)
+ {
+ $this->resetClicked(null,null);
+ }
+ }
+
+ protected function collectSelectionResult($input,$output)
+ {
+ $indices=$input->SelectedIndices;
+ $result='';
+ foreach($indices as $index)
+ {
+ $item=$input->Items[$index];
+ $result.="(Index: $index, Value: $item->Value, Text: $item->Text)";
+ }
+ if($result==='')
+ $output->Text='Your selection is empty.';
+ else
+ $output->Text='Your selection is: '.$result;
+ }
+
+ public function selectionChanged($sender,$param)
+ {
+ $this->collectSelectionResult($sender,$this->SelectionResult);
+ }
+
+ public function buttonClicked($sender, $param)
+ {
+ $data=array();
+ for($i = 0; $i <= $this->box1->Items->Count; $i++)
+ $data[$i]="Item number #".$i;
+ $this->box1->DataSource=$data;
+ $this->box1->dataBind();
+ $this->label1->Text="Total ".count($data)." items";
+ }
+
+ public function resetClicked($sender, $param)
+ {
+ $data=array('item 1','item 2','item 3','item 4');
+ $this->box2->DataSource=$data;
+ $this->box2->dataBind();
+ $this->label2->Text="ListBox has been reset";
+ }
+
+ public function clearClicked($sender, $param)
+ {
+ $this->box2->DataSource=array();
+ $this->box2->dataBind();
+ $this->label2->Text="ListBox cleared";
+ }
+}
+
+?> \ No newline at end of file