+ Start a Discussion
Alex SashaAlex Sasha 

PageRefernese question

When I'm using PageReference class to reference to another page it seems like on referenced page viewstate remains 

Public PageReference backToPage(){

        return new PageReference('/apex/gindex');
    }
so gindex page  has it previouse  viewstate remaind

Is any ways to reference it and reload it fully;

Best Answer chosen by Alex Sasha
BALAJI CHBALAJI CH
Hi Alex Sasha,

Can you please try this below code and let me know if that works for you.
 
Public PageReference backToPage(){
    
    PageReference pgref = new PageReference('/apex/gindex');
    pgref.setRedirect(true);
    return pgref;
}

Best Regards,
BALAJI

All Answers

BALAJI CHBALAJI CH
Hi Alex Sasha,

Can you please try this below code and let me know if that works for you.
 
Public PageReference backToPage(){
    
    PageReference pgref = new PageReference('/apex/gindex');
    pgref.setRedirect(true);
    return pgref;
}

Best Regards,
BALAJI
This was selected as the best answer
Alex SashaAlex Sasha
Yes, it seems like it works