
Here's the full error message "Error: MyController Compile Error: Illegal assignment from LIST<Opportunity> to LIST<Opportunity> at line 16 column 1"
Here's the controller that errors:
public class MyController {
public Id selectedAccount { get; set; }
public List<Opportunity> contactsInformation { get; set; }
public String getContactsInformation() {
return null;
}
public List<Account> getMyAccounts() {
return [SELECT Id, Name, AccountNumber FROM Account ORDER BY
LastModifiedDate DESC LIMIT 10];
}
public void accountClicked() {
contactsInformation = [SELECT Name, Amount FROM Opportunity
WHERE AccountID = :selectedAccount];
}
}
And here's the Page code:
<apex:page controller="MyController">
<apex:form >
<apex:dataList value="{! myaccounts}" var="acct">
<apex:commandlink action="{! accountClicked}" rerender="ContactDetail">
<apex:outputText value="{! acct.name}"/>
<apex:param name="id" value="{! acct.Id}" assignTo="{!selectedAccount}"/>
</apex:commandLink>
</apex:dataList>
</apex:form>
<apex:outputPanel id="ContactDetail">
<apex:repeat value="{! contactsInformation}" var="Opportunity">
<p>{! Opportunity.Name & ' ' & Opportunity.Amount}</p>
</apex:repeat>
</apex:outputPanel>
</apex:page>
2 个回答