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
B TulasiB Tulasi 

how to create link one page to another page in visualforce page.

Hi All,

I am trying give a link one VF Page to another VF Page.

 login = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!login.isEmpty()) {
            Pagereference pr = new PageReference('/apex/timesheet'+login[0].id);  // here Timesheet is another visualforce page
            pr.setReDirect(true);
            return pr;
        }

Error : page timesheeta0928000005arw8aaa does not exist

Thanks in advance
Thulasi.

 
Best Answer chosen by B Tulasi
hitesh90hitesh90
Hello Tulsi,

Is there Visualforce page exist with the name :- timesheet?
If yes, than Try to use following code.
If No, than create one new visualforce page with the name :- timesheet.

Apex Code:
login = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!login.isEmpty()) {
            Pagereference pr = new PageReference('/apex/timesheet?id='+login[0].id);  // here Timesheet is another visualforce page
            pr.setReDirect(true);
            return pr;
        }

Let me know if you have any question on this.

Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/
 

All Answers

hitesh90hitesh90
Hello Tulsi,

Is there Visualforce page exist with the name :- timesheet?
If yes, than Try to use following code.
If No, than create one new visualforce page with the name :- timesheet.

Apex Code:
login = [select ID, Name, User_Name__c, Password__c from Registration__c Where User_Name__c=:userName and Password__c=:password];
        if(!login.isEmpty()) {
            Pagereference pr = new PageReference('/apex/timesheet?id='+login[0].id);  // here Timesheet is another visualforce page
            pr.setReDirect(true);
            return pr;
        }

Let me know if you have any question on this.

Thank You,
Hitesh Patel
Email :- hiteshpatel.aspl@gmail.com
http://mrjavascript.blogspot.in/
 
This was selected as the best answer
B TulasiB Tulasi
Hi Hitesh

Thank u so much