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
asd@as.asdasd@as.asd 

Passing list of account from one page to another page

hello,

how to pass list of account from one page to another page.

plz help me.

thanks.

Chamil MadusankaChamil Madusanka

Same issue here. But there is a solution for your scenario.

 

http://forums.sforce.com/t5/Visualforce-Development/How-to-pass-List-type-parameter-from-one-Visualforce-VF-page-to/td-p/338155

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

Navatar_DbSupNavatar_DbSup

Hi,


As you know we have limitation on passing the value by query string and cookies also. Hence my advice for you is make the same controller for page two also or make it as extension of your page.

 


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.

asd@as.asdasd@as.asd

thanks for reply

i am using same controller for both two page.

when i use Page.pagename than i can get values of first page on second page.

but when i use pagerefrence('url') then i can't get  the values of first page on second page.

udduuddu

I used Page.PageName still I am unable to get the values to next page..

 

MyViewPage:

 

<apex:page controller="wrapperClassController1" >
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Process Selected" action="{!processSelected}" rerender="table"/>
</apex:pageBlockButtons>
<!-- In our table we are displaying the cContact records -->
<apex:pageBlockTable value="{!contacts}" var="c" id="table">
<apex:column >
<!-- This is our selected Boolean property in our wrapper class -->
<apex:inputCheckbox value="{!c.selected}"/>
</apex:column>
<!-- This is how we access the contact values within our cContact container/wrapper -->
<apex:column value="{!c.con.Name}" />
<apex:column value="{!c.con.Email}" />
<apex:column value="{!c.con.Phone}" />
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Controller:

 

public class wrapperClassController1 {
public String val { get; set; }


public List<Contact> disp { get; set; }

//Our collection of the class/wrapper objects cContact
public List<cContact> contactList {get; set;}
public List<Contact> contactLists {get; set;}
public void SetselectedContacts(List<Contact> c){
contactLists =c;
}

public List<Contact> getcontactLists(){
return contactLists;
}
List<Contact> selectedCon = new List<Contact>();
//This method uses a simple SOQL query to return a List of Contacts
public List<cContact> getContacts() {
if(contactList == null) {
contactList = new List<cContact>();
for(Contact c: [select Id, Name, Email, Phone from Contact limit 10]) {
// As each contact is processed we create a new cContact object and add it to the contactList
contactList.add(new cContact(c));
}
}
return contactList;
}

public PageReference processSelected() {

//We create a new list of Contacts that we be populated only with Contacts if they are selected
//We will cycle through our list of cContacts and will check to see if the selected property is set to true, if it is we add the Contact to the selectedContacts list
for(cContact cCon: getContacts()) {
if(cCon.selected == true) {
selectedCon.add(cCon.con);
System.debug('These are the selected Contacts...'+selectedCon);
}
}

this.SetselectedContacts(selectedCon);
// Now we have our list of selected contacts and can perform any type of logic we want, sending emails, updating a field on the Contact, etc
System.debug('These are the selected Contacts...');
PageReference pr =Page.MyViewSelectedList;
pr.setRedirect(false);
for(Contact con: selectedCon) {
system.debug(con);
pr.getParameters().put('ContactsName',string.valueof(selectedCon[0].Name));
system.debug(selectedCon[0].Name+'hellofrom');
}
contactList=null; // we need this line if we performed a write operation because getContacts gets a fresh list now
disp =selectedCon;
val = 'contact';
System.debug(disp+'here is the list');
return pr;

}

public string getval(){
return 'contaact';
}
// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects. In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value
public class cContact {
public Contact con {get; set;}
public Boolean selected {get; set;}

//This is the contructor method. When we create a new cContact object we pass a Contact that is set to the con property. We also set the selected value to false
public cContact(Contact c) {
con = c;
selected = false;
}
}
}

 

second vf page:

 

<apex:page controller="wrapperClassController1" >
<apex:form >
The contacts you selected are!!
<apex:pageBlock >
<apex:pageBlockTable value="{!disp}" var="c" id="table">
<apex:column value="{!val}"/>
<apex:column value="{!c.Name}" />
<apex:column value="{!c.Email}" />
<apex:column value="{!c.Phone}" />
</apex:pageBlockTable>


</apex:pageBlock>
<apex:outputLink >{!val}</apex:outputLink>

</apex:form>
</apex:page>

 

 

Please let me know the issue...Thanks in advance