+ Start a Discussion
Jyoti Singh 9Jyoti Singh 9 

Page redirect not working in VF

Hello,

I try to redirect control from one VF page to another using
 
Public Pagereference go(){
    PageReference pageRef = new PageReference('/apex/MyController?id={!objId}');
    pageRef.setRedirect(true);
   // return pageRef;
   }

but it not works. There is no error, please help to resolve.
Best Answer chosen by Jyoti Singh 9
Gaurav KheterpalGaurav Kheterpal
It should actually be
 
PageReference pageRef = new PageReference('/apex/MyController?id=' + orderId.id);
This should fix it

If my answer helps resolve your query, please mark it as the 'Best Answer' to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Developer Forums Moderator| Dreamforce Speaker