<apex:page controller="recordPageCont">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!EditAccount}"/>
<apex:commandButton value="Cancel" action="{!CancelButton}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:outputField value="{!objAccount.Name}"/>
<apex:outputField value="{!objAccount.AccountNumber} "/>
<apex:outputField value="{!objAccount.Type} "/>
<apex:outputField value="{!objAccount.industry} "/>
<apex:outputField value="{!objAccount.Rating} "/>
<apex:page controller="recordPageCont">
<apex:form >
<apex:pageBlock >
<apex:pageBlockButtons >
<apex:commandButton value="Edit" action="{!EditAccount}"/>
<apex:commandButton value="Cancel" action="{!CancelButton}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:outputField value="{!objAccount.Name}"/>
<apex:outputField value="{!objAccount.AccountNumber} "/>
<apex:outputField value="{!objAccount.Type} "/>
<apex:outputField value="{!objAccount.industry} "/>
<apex:outputField value="{!objAccount.Rating} "/>
<b>Email</b> {!objAccount.Name}@salesforce.com
<apex:outputField value="{!objAccount.Rating} "/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:pageBlock title="Contacts Related With {!objaccount.name}"></apex:pageBlock>
<apex:form >
<apex:outputPanel id="ContactDetail">
<apex:repeat value="{! displayContacts}" var="contact">
<p>{! contact.name & ' ' & contact.title}</p>
</apex:repeat>
</apex:outputPanel>
</apex:form>>
</apex:page>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
<apex:pageBlock title="Contacts Related With {!objaccount.name}"></apex:pageBlock>
<apex:form >
<apex:outputPanel id="ContactDetail">
<apex:repeat value="{! displayContacts}" var="contact">
{! contact.name & ' ' & contact.title}
</apex:form>>
</apex:page>
apex page
public class recordPageCont {
public Account objAccount{get;set;}
Public string recId{get;set;}
Contact[] displayContacts {get;set;}
public recordPageCont ()
{
recId = apexpages.currentpage().getparameters().get('id');
objAccount =[SELECT Name, AccountNumber ,Type , Industry , Rating,(SELECT Name , MobilePhone,Title from Contacts)
FROM account
WHERE ID = :recId ];controller
public class recordPageCont {
public Account objAccount{get;set;}
Public string recId{get;set;}
Contact[] displayContacts {get;set;}
public recordPageCont ()
{
recId = apexpages.currentpage().getparameters().get('id');
objAccount =[SELECT Name, AccountNumber ,Type , Industry , Rating,(SELECT Name , MobilePhone,Title from Contacts)
FROM account
WHERE ID = :recId ];
Account[] accts =[SELECT Name, AccountNumber ,Type , Industry , Rating,(SELECT Name , MobilePhone,Title from Contacts)
FROM account
WHERE ID = :recId ];
Account acct = accts[0];
//acct.Contacts is a List
if (!objAccount.Contacts.isEmpty()){
displayContacts = acct.Contacts;
Account acct = accts[0];
//acct.Contacts is a List<Contact>
if (!objAccount.Contacts.isEmpty()){
displayContacts = acct.Contacts;
}}
Public pagereference Editaccount()
{
Pagereference edtaccount = new Pagereference('/apex/editaccount?id='+recid);
edtaccount.setredirect(true);
return edtaccount;
}
public pagereference cancelButton()
{
Pagereference cnclbutton = new Pagereference('/apex/accountdisplay');
cnclbutton.setredirect(true);
return cnclbutton;
}
}
}
Error: Unknown property 'recordPageCont.displayContacts'
Quick Fix Create Apex property 'recordPageCont.displayContacts'
Quick Fix Create Apex method 'recordPageCont.getDisplayContacts'
Error: Unknown property 'recordPageCont.displayContacts' Quick
Fix Create Apex property 'recordPageCont.displayContacts' Quick
Fix Create Apex method 'recordPageCont.getDisplayContacts'
<apex:outputPanel id="ContactDetail">
<apex:repeat value="{! displayContacts}" var="contact">
<apex:outputPanel id="ContactDetail">
<apex:repeat value="{! displayContacts}" var="contact">
<p>{! contact.name & ' ' & contact.title}</p>
</apex:repeat>
</apex:outputPanel>
{! contact.name & ' ' & contact.title}