How to add button or Link to visualforce page whose standard controller is not same as applying tab?
I have visualforce page CompetitorSearch.page
that use CompSearchDummy__c
as standard contro开发者_如何学运维ller.
<apex:page StandardController="CompSearchDummy__c" extensions="CompetitorSearch">
If I am to add custom button on the page of CompSearchDummy
, CompetitorSearch.page
shows up for the page destination.
But I have Talent
page which use Talent__c sObject
and when I tried to add custom button and attempt to set destination, CompetitorSearch.page
does not show up as an option because I did not set Talent__c
as standard controller
.
Is it possible to somehow add my CompetitorSearch.page link to Talent page?
If I understand your question correctly, you want to add an apex:commandButton
to go to another page. When you were on the same page, it was just refreshing itself, but to go to another page, you need to specify an action in the apex:commandButton
that points to a method in a controller extension that returns a PageReference for where you want to go. Like this:
<apex:commandButton action="{!gotoCompetitorSearch}" value="Competitor Search" />
public PageReference gotoCompetitorSearch() {
return Page.CompetitorSearch;
}
Note, if you don't really need a button or special logic and just want to go to another page, you can do this with just an apex:outputLink
with no need for a controller extension, like this:
<apex:outputLink value="{!$Page.CompetitorSearch}">CompetitorSearch</apex:outputLink>
精彩评论