+ Start a Discussion

reload visualforce page after export csv file

I have a visualforce page in which I reterieve record after search in a pageblock table. I have a button which exports a CSV file for those records. For those CSV records I have written a visualforce page whose content type I have set to CSV. After export CSV file I want to reload the page.
Ravi NarayananRavi Narayanan

<apex:commandButton value="{!export}"  rerender="pageblockid"/> 

If your issue is the page redirecting to blank page after exporting, then try the above steps.

Rerender eiother pageblock or outputpanel in that commandButton. it will prevent from redirecting to blank page after exporting to csv.


Ravi NarayananRavi Narayanan
if you want to refresh same page, just specify your pageid instead of pageblockid.

make sure you specify setredirect(false) in your pagereference  method of export CSV /return NULL. 
Shabbir ShaikShabbir Shaik

After your Export operation do like this in same method,
Pagereference pf=new Pagereference('/apex/yourpagename');
return pf;
Try this...and if this helps, mark this as  'Best Answer'.