function DataBind() { if (isset($this->DataSourceText) && isset($this->DataSourceValue)) { $this->DataColumns = array($this->DataSourceText, $this->DataSourceValue); parent::DataBind(); if (isset($this->Data) && $this->Data != null) { $data = $this->Data; $datasourcetext = $this->DataSourceText; $datasourcevalue = $this->DataSourceValue; foreach ($data as $key => $val) { $dataitem = $val; if (is_array($dataitem)) { $text = $dataitem[$datasourcetext]; $value = $dataitem[$datasourcevalue]; } else { $text = $dataitem; $value = $i; } $li = new ListItem(); $li->Text = $text; $li->Value = $value; $this->Items[] = $li; } } } }
function Render() { parent::Render(); $strcombo = "{$this->Caption}<br><table {$this->Attributes} cellpadding='3' cellspacing='0' border='1'>"; $strcombo .= $this->RenderItems(); $strcombo .= "</table>"; return $strcombo; }
function DataBind() { parent::DataBind(); if (isset($this->Data)) { $data = $this->Data; $dataselecttext = $this->DataSelectColumn; $dataselectvalue = $this->DataSourceValue; for ($i = 0; $i < count($data); $i++) { $dataitem = $data[$i]; if (is_array($dataitem)) { $text = $dataitem[$datasourcetext]; $value = $dataitem[$datasourcevalue]; } else { $text = $dataitem; $value = $i; } $li = new ListItem(); $li->Text = $text; $li->Value = $value; $this->Items[] = $li; } } }