You need to sign in to do that
Don't have an account?
New_Developer
Calling child object records in a visulaforce page
How to reference a child object and call the child object records in a visualforce page with master object as standard controller
In case of child object and master object as the standard controller, you can use the pageblock table or data table for child records. In the extension class retrieve the child record by SOQL query and store the retrieved records in a list variable. Use the getter of this list variable in the page block/data table to display the records on vf page.
For eg:
VF page
<apex:page standardController="MasterObject" extensions="Class1">
<apex:pageblocktable value="{!childrecords}" var="rec">
<apex:column value="{!rec.name}"/>
</apex:page>
class
public class class1
{
public list<ChildRecordObject> childrecords {get;set;} /** Retrieve the child records and store it in this varaiable which is referenced on page.I am not sure of your scenario i.e. when do you want to display the records on page. You can also write SOQL and assign values to this variable in the constructor and the child records will be displayed on the page load itself.. */
}
You can directly Accesss Child records using the RelationshipName, see this example.
In this Opportunities,Contacts,Cases are relationship Names. These Relationship Names will give you all the records associated with the account that you wil see for contact , oopurtunity and case. If you want some specific records then you need to use a extention class and Use SOQL and prepare a list and show it on the page.