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
srikrishna_adm2011.3922319118806626E12srikrishna_adm2011.3922319118806626E12 

2 visualforce with same standard controller not retaining data

Hi All,

I'm using same standard controller and same extention class for my page1 and page2. when i redirect from page1 to page2, i want to do some action in page 2 and i'm not getting any data of extention class calculated as a part of page1 in my vf page2. i put system.debug in my extention class and they are null when i perform any action in page 2 (like clicking button). I read many blogs and everywhere its suggested that having same controller will retain data accross the pages. I'm not sure what i'm missing here.

I'm redirecitng like this
PageReference page = new PageReference('Apex/Page2');
page.setRedirect(false);
return page;
Addition Info: Page 1 has standard set controller and page 2 has standard controller

Thanks in Advance
Srikrishna
Jason PaineJason Paine
You need to save data back to the object and  pass the id value to the next page
This is code from an extension using the standard Lead controller.

public PageReference nextPage2() {
        update lead;  //Upldates the object
        PageReference pageRef= Page.Page2;
        pageRef.setRedirect(true);
        pageRef.getParameters().put('id',Lead.id);
        return pageRef;
    }