+ 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?
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/>
  <b>Contact List</b><br/>
  <apex:dataTable value="{!Account.Contacts}" var="con">
      <apex:column value="{!con.Name}"/>
  <b>Opportunity List</b><br/>  
  <apex:dataTable value="{!Account.Opportunities}" var="opty">
      <apex:column value="{!opty.Name}"/>