You need to sign in to do that
Don't have an account?
priya bhawna shetty
page reference related in visualforce
hi guys
please help me out with this requiment
1.i displayed list of opportunity names&related stagenames in visualforce development mode,so now i want to navigate to detail page of that particular opportunity name ,when i clicked on it.
heres my code.
please tell me how do i do this by using javascript or by command link
PAGE:
<apex:page controller="opportunitydisplaycon" id="thePage">
<apex:form >
<script>
function generatedjs(){
gotodetail();
</script>
<apex:dataTable value="{!opportunity}" var="opp" id="theTable"
styleClass="tableClass">
<apex:facet name="caption">opportunity Details</apex:facet>
<apex:column >
<apex:facet name="header">opportunity Name</apex:facet>
<a rerender="commandlink1" href="javascript:generatedJs();">{!opp.name}</a>
<apex:commandLink action="{!gotodetail}" id="commnadlink1"/>
</apex:column>
<apex:column >
<apex:facet name="header">opportunity stage</apex:facet>
<apex:outputText value="{!opp.stagename}"/>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:page>
CONTROLLER:
public class opportunitydisplaycon {
public List<opportunity> opportunity;
public List<opportunity> getopportunity()
{
opportunity = [select name,stagename from opportunity limit 10];
return opportunity;
}
public PageReference gotodetail() {
pageReference p=new pageReference('/'+'recordID');
p.setredirect(true);
return p;
}
}
please help me out with this requiment
1.i displayed list of opportunity names&related stagenames in visualforce development mode,so now i want to navigate to detail page of that particular opportunity name ,when i clicked on it.
heres my code.
please tell me how do i do this by using javascript or by command link
PAGE:
<apex:page controller="opportunitydisplaycon" id="thePage">
<apex:form >
<script>
function generatedjs(){
gotodetail();
</script>
<apex:dataTable value="{!opportunity}" var="opp" id="theTable"
styleClass="tableClass">
<apex:facet name="caption">opportunity Details</apex:facet>
<apex:column >
<apex:facet name="header">opportunity Name</apex:facet>
<a rerender="commandlink1" href="javascript:generatedJs();">{!opp.name}</a>
<apex:commandLink action="{!gotodetail}" id="commnadlink1"/>
</apex:column>
<apex:column >
<apex:facet name="header">opportunity stage</apex:facet>
<apex:outputText value="{!opp.stagename}"/>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:page>
CONTROLLER:
public class opportunitydisplaycon {
public List<opportunity> opportunity;
public List<opportunity> getopportunity()
{
opportunity = [select name,stagename from opportunity limit 10];
return opportunity;
}
public PageReference gotodetail() {
pageReference p=new pageReference('/'+'recordID');
p.setredirect(true);
return p;
}
}
you dont need a controller action or javascript for this.. you can directly invoke the detail page with the link..
<apex:page controller="opportunitydisplaycon" id="thePage">
<apex:form >
<apex:dataTable value="{!opportunity}" var="opp" id="theTable" styleClass="tableClass">
<apex:facet name="caption">opportunity Details</apex:facet>
<apex:column >
<apex:facet name="header">opportunity Name</apex:facet>
<a href="/{!opp.Id}">{!opp.name}</a>
</apex:column>
<apex:column >
<apex:facet name="header">opportunity stage</apex:facet>
<apex:outputText value="{!opp.stagename}"/>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:page>
CONTROLLER:
public class opportunitydisplaycon {
public List<opportunity> opportunity;
public List<opportunity> getopportunity()
{
opportunity = [select id,name,stagename from opportunity limit 10];
return opportunity;
}
}
many thanks
it worked....