anusha(salesforce developer)

Wednesday 14 September 2016

How to open another Visualforce page from current Visualforce page in Salesforce?

How to open another Visualforce page from current Visualforce page in Salesforce?


Visualforce page:

<apex:page controller="sample">

<apex:form>
            <apex:commandButton value="Open" action="{!openPage}"/>   

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


Apex Class: 

public class sample
{
    public pageReference openPage()
    {
        pageReference pg = new pageReference('/apex/Name_Of_The_Page');
        pg.setRedirect(true);
        return pg;
    }     
}

No comments:

Post a Comment