You need to sign in to do that
Don't have an account?
Accessing Child object fields in VF page
Hey folks,
I'm trying to access the child object fields in the visual force page with standard controller as parent. In my case, parent object is student__c, child object is merchandise__c . I'm trying to access the price field in merchandise, But I'm getting the error "unknown property 'Student__cStandard controller.stud' ". Should i use both student and merchandise as standard controllers in VF page? Please guide me in this issue.
CODE:
VF page:
<apex:page standardController="Student__c" extensions="StudentController" action="{!TimeVO}" >
<apex:form >
<apex:pageBlock title="StudentList" >
<apex:pageBlockSection >
<apex:pageBlockTable value ="{!Stud}" var = "p">
<apex:column headervalue="StudentName"><apex:outputLink value="/apex/StudentForm?id={!p.id}">{!p.StudentName__c}</apex:outputLink></apex:column>
<apex:column headervalue="price">{!p.Price__c}</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
I'm just pasting the sample code. i'm using the controller, because i have to write a business logic in the controller depending on the values of child object field.
Hello john,
you can not use multiple standardcontroller in VF page.you can use it page side. follow this link- http://boards.developerforce.com/t5/Visualforce-Development/Multiple-Standard-Controller/m-p/222839#M30515
try this code :-
VF page:
<apex:page standardController="Student__c" extensions="StudentController" action="{!TimeVO}" >
<apex:form >
<apex:pageBlock title="StudentList" >
<apex:pageBlockSection >
<apex:pageBlockTable value ="{!Stud}" var = "p">
<apex:column headervalue="StudentName"><apex:outputLink value="/apex/StudentForm?id={!p.id}">{!p.StudentName__c}</apex:outputLink></apex:column>
<apex:column headervalue="price">{!p.Price__c}</apex:column>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>