You need to sign in to do that
Don't have an account?
Phanindra
I am trying to navigate to different apex page for that I have written an apex class but it is giving an error. Compile Error: Method does not exist or incorrect signature: [System.PageReference].sendRedirect(Boolean) at line 12 column 1
public class SecondExtension{
public Admin__c adminRecord;
public SecondExtension(ApexPages.StandardController stdCon){
adminRecord=(Admin__c)stdCon.getRecord();
}
public PageReference save(){
insert adminRecord;
PageReference pg=new PageReference('apex/PageConfirmation');
pg.sendRedirect(true);
}
public PageReference cancel(){
PageReference pg=new PageReference('/a09/o');
pg.sendRedirect(true);
}
}
public Admin__c adminRecord;
public SecondExtension(ApexPages.StandardController stdCon){
adminRecord=(Admin__c)stdCon.getRecord();
}
public PageReference save(){
insert adminRecord;
PageReference pg=new PageReference('apex/PageConfirmation');
pg.sendRedirect(true);
}
public PageReference cancel(){
PageReference pg=new PageReference('/a09/o');
pg.sendRedirect(true);
}
}
Instead of using sendRedirect() method, you can directly return that page to navigate.
Please find below modified code:
Let us know if that helps you.
Best Regards,
BALAJI
Michael_Kong
Your code do not contain any issue the only thing is that use return type insted of sendRedirect.
PageRefrence class do not contain any member fuction or variable related to send Redirect.
Hope its work.
If not then let me know .
Regards
Ram Agarawal
Please use the below code snippet.