public function EditColumn_Render(Person $objPerson)
{
if ($objPerson->Id == $this->intEditPersonId || $this->intEditPersonId == -1 && !$objPerson->Id) {
// We are rendering the row of the person we are editing OR we are rending the row
// of the NEW (blank) person. Go ahead and render the Save and Cancel buttons.
return $this->btnSave->Render(false) . ' ' . $this->btnCancel->Render(false);
} else {
// Get the Edit button for this row (we will create it if it doesn't yet exist)
$strControlId = 'btnEdit' . $objPerson->Id;
$btnEdit = $this->GetControl($strControlId);
if (!$btnEdit) {
// Create the Edit button for this row in the DataGrid
// Use ActionParameter to specify the ID of the person
$btnEdit = new QButton($this->dtgPersons, $strControlId);
$btnEdit->Text = 'Edit This Person';
$btnEdit->ActionParameter = $objPerson->Id;
$btnEdit->AddAction(new QClickEvent(), new QAjaxAction('btnEdit_Click'));
$btnEdit->CausesValidation = false;
}
// If we are currently editing a person, then set this Edit button to be disabled
if ($this->intEditPersonId) {
$btnEdit->Enabled = false;
} else {
$btnEdit->Enabled = true;
}
// Return the rendered Edit button
return $btnEdit->Render(false);
}
}