i am trying to export my data as csv file using another csv VF page, but the problem is that it redirect automatically to a blank page, and i want to staty in the same page after export. i have tried to return null from apex function, but it stop to download the csv file. also i have tried to setRedirect to false but no change in the result. here is my code: export function:

    public PageReference export() {
    PageReference ref;
    ref = Page.ExportCsv;
    return ref;

the exportExcel VF page:

<apex:page standardController="objectName" extensions="exportController" cache="true"
       readOnly="true" contentType="application/octet-stream#{!fileName}.csv"
       showHeader="false" sidebar="false" standardStylesheets="false">item name, provider name

export button code:

<apex:commandButton Id="DownCSV"
                                                                                styleClass="DownCSV" value="Download as CSV"
                                                                                rerender="outputPanel1, outputPanel2"
  • Please edit your question to clarify: Is ExportCsv a separate page from yours? When export is complete, do you want to remain on ExportCsv or return to your page? – David Cheng Oct 10 '19 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.