[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/demos/quickstart/protected/pages/Controls/Samples/TRadioButtonList/ -> Home.php (source)

   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->DBRadioButtonList1->DataSource=$data;
  12              $this->DBRadioButtonList1->dataBind();
  13  
  14              $data=array('key 1'=>'item 1','key 2'=>'item 2',
  15                          'key 3'=>'item 3','key 4'=>'item 4');
  16              $this->DBRadioButtonList2->DataSource=$data;
  17              $this->DBRadioButtonList2->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->DBRadioButtonList3->DataSource=$data;
  24              $this->DBRadioButtonList3->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->RadioButtonList,$this->SelectionResult);
  46      }
  47  
  48  	public function selectionChanged($sender,$param)
  49      {
  50          $this->collectSelectionResult($sender,$this->SelectionResult2);
  51      }
  52  
  53  	public function DBRadioButtonList1Changed($sender,$param)
  54      {
  55          $this->collectSelectionResult($sender,$this->DBRadioButtonList1Result);
  56      }
  57  
  58  	public function DBRadioButtonList2Changed($sender,$param)
  59      {
  60          $this->collectSelectionResult($sender,$this->DBRadioButtonList2Result);
  61      }
  62  
  63  	public function DBRadioButtonList3Changed($sender,$param)
  64      {
  65          $this->collectSelectionResult($sender,$this->DBRadioButtonList3Result);
  66      }
  67  }
  68  
  69  ?>


Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7