+ Start a Discussion
srinivas pulipatisrinivas pulipati 

We have 3 objects Account, Contact, Opportunity. In a VF page, we need to display the names of contact & Opportunity which are related to Account.

Plz Explain this que answer?
KaranrajKaranraj
Srinivas - Try the below visualforce page code using standard controller to display the Account information and its related Contact and Opportunity records
<apex:page standardController="Account">
  Name : <apex:outputField value="{!Account.Name}"/> <br/>
  Phone : <apex:OutputField value="{!Account.Phone}" /><br/>
  <br/>
  <b>Contact List</b><br/>
  <apex:dataTable value="{!Account.Contacts}" var="con">
      <apex:column value="{!con.Name}"/>
  </apex:dataTable><br/><br/>
  <b>Opportunity List</b><br/>  
  <apex:dataTable value="{!Account.Opportunities}" var="opty">
      <apex:column value="{!opty.Name}"/>
  </apex:dataTable>
</apex:page>