function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sroberts_MEsroberts_ME 

export to excel button using two pages

Hi all,

 

I have two VF pages that use the same controller. The first page has a button that searchs based on user input and redirects to the second page. The second page should open an excel sheet with the results of the search, but it always comes out blank. The search function works fine without the page redirect so I'm wondering if the redirect is reinitializing the controller. If that's the case how can I pass the results onto the next page?

 

-Sam

Ankit AroraAnkit Arora

Some code snippet will help us to know more about your problem.

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

sroberts_MEsroberts_ME

 public PageReference search(){

...

wap = [SELECT stuff FROM place ];                      

PageReference p = Page.AssetSearchOut;       

p.setRedirect(true);        

return p; }

 

in the page AssetSearchOut I am trying to access the query I made in the search function using {!wap}. Remember that both pages have the same controller, so I know that it sees the variable. The question is, does it reload the controller, and therefore clear the list search generated? If it does how can I use the results of this query based on user input in a different visualforce page that I will export to an excel file. 

 

Shashikant SharmaShashikant Sharma

Update this to

public PageReference search(){
...
wap = [SELECT stuff FROM place ];                      
PageReference p = Page.AssetSearchOut;       
p.setRedirect(false);        
return p; }

 setredirect(true) , reinitilize the controller class.