0

I am started learning standard controller in visualforce. I have two custom object: Timesheet__c & Timeentries__c.I want to display the timeentries__c details in timesheet__c matching with Id.Can anyone help me to solve it.

Code

<apex:page standardController="Time_Entry__c">
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection title="Time Entry Details">
                <apex:inputField value="{! Time_Entry__c.User_Name__c}"/>
                <apex:inputField value="{! Time_Entry__c.Start_Date_Time__c}"/>
                <apex:inputField value="{! Time_Entry__c.End_Date_Time__c}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!Save}" value="Save"/>
                <apex:commandButton action="{!cancel}" value="Cancel"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
  
</apex:page>

1 Answer 1

0

Displaying Related Lists for Custom Objects

Displaying custom objects and their related lists with Visualforce is very simple.

Suppose you have three custom objects: MyChildObject, MyMasterObject, and MyLookupObject. MyChildObject has a master-detail relationship with MyMasterObject (which is the master). MyLookupObject also has a Lookup relationship with MyChildObject.

If you want to create a Visualforce page that displays the related list for MyMasterObject, use the following markup:

<apex:page standardController="MyMasterObject__c">
    <apex:relatedList list="MyChildObjects__r" />
</apex:page>

Reference:- Displaying Related Lists for Custom Objects in vf page

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .