You need to sign in to do that
Don't have an account?

passing id from one vf page to other vf page
Hi All,
I have 3 vf pages .!st page is eventdetails page where i have all outputfields showing event details .In this page i have a button called proceed for registration .The controller code for this page is
public class Proceedbutton {
private final ApexPages.StandardController controller;
public Proceedbutton (ApexPages.StandardController stdController) {
this.controller = stdController;
}
Static Id id1=ApexPages.currentPage().getParameters().get('id');
public PageReference proceed()
{
Pagereference EventRegister= Page.EventRegister;
EventRegister.setRedirect(True);
return EventRegister;
}
Public static Id getid()
{ return id1;}
}
Here in this controller I am trying to get the event id in the id1 variable after that it goes to Eventregister page.
In Eventregister page,User enters his information and clicks register .Here I have controller which stores the data and goes to tranks vf page .
Here’s the code
public class Registerbutton {
private final ApexPages.StandardController controller;
public Registerbutton (ApexPages.StandardController stdController) {
this.controller = stdController;
}
public PageReference Register()
{
Registrant__c reg = (Registrant__c)controller.getRecord();
reg.Event__c=Proceedbutton.getid();
//reg.Event__c='a06S0000002VZMw';
insert reg;
Pagereference EventThankyou = Page.EventThankyou ;
EventThankyou.setRedirect(True);
return EventThankyou;
}
}
In this controller , just before saving the registrant record, I am calling the getid() method on proceedbutton controller to get the eventid .I am trying to link all registrants to that event by doing so.Event__c is a lookup field on Registrant object pointing to Event object
But I am not getting the expected result in the line reg.Event__c=Proceedbutton.getid();
Can anyone please help me what I am doing wrong here ?
Hey
follow this example
Page#1 your sumbit button Apex code
public PageReference Sumbit(){
PageReference tosecondpage = Page.secondpage;
tosecondpage.getParameters().put('paramID',acc.ID);
tosecondpage.setRedirect(true);
return tosecondpage;
}
Page#2 Apex code
String accountID
public void intSecondPage(){
accountID= ApexPages.currentPage().getParameters().get('paramID');
}
cheers
suresh
All Answers
Hey
follow this example
Page#1 your sumbit button Apex code
public PageReference Sumbit(){
PageReference tosecondpage = Page.secondpage;
tosecondpage.getParameters().put('paramID',acc.ID);
tosecondpage.setRedirect(true);
return tosecondpage;
}
Page#2 Apex code
String accountID
public void intSecondPage(){
accountID= ApexPages.currentPage().getParameters().get('paramID');
}
cheers
suresh
Thanks a lot ..Its working as expected...