+ Start a Discussion
Akash DalviAkash Dalvi 

I want to display selected records of page 1 on page 2 on button click.Both pages share the same controller.How would I do that?

I've posted the same question on stackexchange but haven't found any solution yet.Please refere the below link to have a look on my controller,Page1 and Page2.
http://salesforce.stackexchange.com/questions/83632/i-want-to-display-selected-records-of-page-1-on-page-2-both-pages-share-the-same


It would be great if anyone can sort out this.Thanks in advance.!! :)


 
Best Answer chosen by Akash Dalvi
VahidVahid

Controller:
public class redirectdemocontroller{
    public String name {get;set;}
    public List<Contact> conList{get;set;}
    public PageReference redirect(){
        name = 'test';
        conList = Database.Query('select id, name from contact where name like \'%' + name + '%\'');
        PageReference pg = new PageReference('/apex/page2');
        return pg;
    }
}

Page1:
<apex:page controller="redirectdemocontroller">
<apex:form>
    <apex:commandButton value="Redirect" action="{!redirect}"/>
</apex:form>
</apex:page>

Page2:
<apex:page controller="redirectdemocontroller">
<apex:pageBlock>
    <apex:pageBlockTable value="{!conList}" var="con">
        <apex:column value="{!con.name}"/>
    </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

Thanks
Abdul Vahid
www.ibirdsservices.com
(iBirds Software Services Pvt. Ltd.)