I Created a link (ToExcelLink) on my page (outside the grid) to export the data in the Grid to an excel file. Part of the export works because the excel file is created with the controls of my page. But the grid with the data is missing. What am I missing?
The link's Default value is "Export to Excel"
The href source is "Score_Card_Show_All.ccp" (My page's name)
The link parameter name is "export"
The link parameter source type is "Expression"
The link parameter source is "1"
The code in my grid's BeforeSelect event:
function EditableGrid1_BeforeSelect(& $sender)
{
$EditableGrid1_BeforeSelect = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $EditableGrid1; //Compatibility
if (CCGetFromGet("export") == "1") {
//Show up to 10,000 records
$EditableGrid1->PageSize = 10000;
$EditableGrid1->ds->PageSize = 10000;
//Hide the Navigator
$EditableGrid1->Navigator->Visible = false;
}
return $EditableGrid1_BeforeSelect;
}
The code in my page's OnInitializeView event:
function Page_OnInitializeView(& $sender)
{
$Page_OnInitializeView = true;
$Component = & $sender;
$Container = & CCGetParentContainer($sender);
global $Score_Card_Show_All; //Compatibility
global $ToExcelLink;
global $Header;
global $Link1;
$ExportFileName = "Report.xls";
if (CCGetFromGet("export") == "1") {
//Hide the ToExcelLink Link
$ToExcelLink->Visible = false;
$Link1->Visible = false;
$Header->Visible = false;
//Set Content type to Excel
header("Content-Type: application/vnd.ms-excel");
//Fix IE 5.0-5.5 bug with Content-Disposition=attachment
if (strpos($SERVER["HTTP_USER_AGENT"],"MSIE 5.5;") ||
strpos($SERVER["HTTP_USER_AGENT"],"MSIE 5.0;")) {
header("Content-Disposition: filename=" . $ExportFileName);
} else {
header("Content-Disposition: attachment; filename=" . $ExportFileName);
}
}
return $Page_OnInitializeView;
}