protected function dtgDatagrid_Bind()
 {
     // Because we want to enable pagination AND sorting, we need to setup the $objClauses array to send to LoadAll()
     // Remember!  We need to first set the TotalItemCount, which will affect the calcuation of LimitClause below
     $this->dtgDatagrid->TotalItemCount = Datagrid::CountAll();
     // Setup the $objClauses Array
     $objClauses = array();
     // If a column is selected to be sorted, and if that column has a OrderByClause set on it, then let's add
     // the OrderByClause to the $objClauses array
     if ($objClause = $this->dtgDatagrid->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     // Add the LimitClause information, as well
     if ($objClause = $this->dtgDatagrid->LimitClause) {
         array_push($objClauses, $objClause);
     }
     // Set the DataSource to be the array of all Datagrid objects, given the clauses above
     $this->dtgDatagrid->DataSource = Datagrid::LoadAll($objClauses);
 }
 /**
  * Refresh this MetaControl with Data from the local DatagridColumnPreference object.
  * @param boolean $blnReload reload DatagridColumnPreference from the database
  * @return void
  */
 public function Refresh($blnReload = false)
 {
     if ($blnReload) {
         $this->objDatagridColumnPreference->Reload();
     }
     if ($this->lblDatagridColumnPreferenceId) {
         if ($this->blnEditMode) {
             $this->lblDatagridColumnPreferenceId->Text = $this->objDatagridColumnPreference->DatagridColumnPreferenceId;
         }
     }
     if ($this->lstDatagrid) {
         $this->lstDatagrid->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstDatagrid->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objDatagridArray = Datagrid::LoadAll();
         if ($objDatagridArray) {
             foreach ($objDatagridArray as $objDatagrid) {
                 $objListItem = new QListItem($objDatagrid->__toString(), $objDatagrid->DatagridId);
                 if ($this->objDatagridColumnPreference->Datagrid && $this->objDatagridColumnPreference->Datagrid->DatagridId == $objDatagrid->DatagridId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstDatagrid->AddItem($objListItem);
             }
         }
     }
     if ($this->lblDatagridId) {
         $this->lblDatagridId->Text = $this->objDatagridColumnPreference->Datagrid ? $this->objDatagridColumnPreference->Datagrid->__toString() : null;
     }
     if ($this->txtColumnName) {
         $this->txtColumnName->Text = $this->objDatagridColumnPreference->ColumnName;
     }
     if ($this->lblColumnName) {
         $this->lblColumnName->Text = $this->objDatagridColumnPreference->ColumnName;
     }
     if ($this->lstUserAccount) {
         $this->lstUserAccount->RemoveAllItems();
         if (!$this->blnEditMode) {
             $this->lstUserAccount->AddItem(QApplication::Translate('- Select One -'), null);
         }
         $objUserAccountArray = UserAccount::LoadAll();
         if ($objUserAccountArray) {
             foreach ($objUserAccountArray as $objUserAccount) {
                 $objListItem = new QListItem($objUserAccount->__toString(), $objUserAccount->UserAccountId);
                 if ($this->objDatagridColumnPreference->UserAccount && $this->objDatagridColumnPreference->UserAccount->UserAccountId == $objUserAccount->UserAccountId) {
                     $objListItem->Selected = true;
                 }
                 $this->lstUserAccount->AddItem($objListItem);
             }
         }
     }
     if ($this->lblUserAccountId) {
         $this->lblUserAccountId->Text = $this->objDatagridColumnPreference->UserAccount ? $this->objDatagridColumnPreference->UserAccount->__toString() : null;
     }
     if ($this->chkDisplayFlag) {
         $this->chkDisplayFlag->Checked = $this->objDatagridColumnPreference->DisplayFlag;
     }
     if ($this->lblDisplayFlag) {
         $this->lblDisplayFlag->Text = $this->objDatagridColumnPreference->DisplayFlag ? QApplication::Translate('Yes') : QApplication::Translate('No');
     }
 }
 public function dtgDatagrid_Bind()
 {
     // Get Total Count b/c of Pagination
     $this->dtgDatagrid->TotalItemCount = Datagrid::CountAll();
     $objClauses = array();
     if ($objClause = $this->dtgDatagrid->OrderByClause) {
         array_push($objClauses, $objClause);
     }
     if ($objClause = $this->dtgDatagrid->LimitClause) {
         array_push($objClauses, $objClause);
     }
     $this->dtgDatagrid->DataSource = Datagrid::LoadAll($objClauses);
 }
 protected function lstDatagrid_Create()
 {
     $this->lstDatagrid = new QListBox($this);
     $this->lstDatagrid->Name = QApplication::Translate('Datagrid');
     $this->lstDatagrid->Required = true;
     if (!$this->blnEditMode) {
         $this->lstDatagrid->AddItem(QApplication::Translate('- Select One -'), null);
     }
     $objDatagridArray = Datagrid::LoadAll();
     if ($objDatagridArray) {
         foreach ($objDatagridArray as $objDatagrid) {
             $objListItem = new QListItem($objDatagrid->__toString(), $objDatagrid->DatagridId);
             if ($this->objDatagridColumnPreference->Datagrid && $this->objDatagridColumnPreference->Datagrid->DatagridId == $objDatagrid->DatagridId) {
                 $objListItem->Selected = true;
             }
             $this->lstDatagrid->AddItem($objListItem);
         }
     }
 }