ExampleForm::chkSelected_Render PHP Method

chkSelected_Render() public method

This method (declared as public) will help with the checkbox column rendering
public chkSelected_Render ( Person $objPerson )
$objPerson Person
    public function chkSelected_Render(Person $objPerson)
    {
        // In order to keep track whether or not a Person's Checkbox has been rendered,
        // we will use explicitly defined control ids.
        $strControlId = 'chkSelected' . $objPerson->Id;
        // Let's see if the Checkbox exists already
        $chkSelected = $this->GetControl($strControlId);
        if (!$chkSelected) {
            // Define the Checkbox -- it's parent is the Datagrid (b/c the datagrid is the one calling
            // this method which is responsible for rendering the checkbox.  Also, we must
            // explicitly specify the control ID
            $chkSelected = new QCheckBox($this->dtgPersons, $strControlId);
            $chkSelected->Text = 'Select';
            // We'll use Control Parameters to help us identify the Person ID being copied
            $chkSelected->ActionParameter = $objPerson->Id;
            // Let's assign a server action on click
            $chkSelected->AddAction(new QClickEvent(), new QServerAction('chkSelected_Click'));
        }
        // Render the checkbox.  We want to *return* the contents of the rendered Checkbox,
        // not display it.  (The datagrid is responsible for the rendering of this column).
        // Therefore, we must specify "false" for the optional blnDisplayOutput parameter.
        return $chkSelected->Render(false);
    }