+ Start a Discussion
smagee13smagee13 

Unknown property error message

Newbie question, so thanks for any help

 

I have a custom object called Project_ka_c that holds a list of projects.  Related to this object is the Cases object, where you can have multiple cases for each project.

 

Im trying to develop a custom VF page that will list, for a given project, all the related cases.

 

Have the following VF page

 

<apex:page standardController="project_ka__c" showHeader="false"
    sidebar="false" extensions="CustomController">
    <apex:form>
        <apex:pageBlock>
            <apex:pageBlockSection title="Projects Cases">
                <apex:dataTable value="{!CustomController}" var="CC"
                    styleClass="list">
                    <apex:column value="{!CC.ID}" />
                    <apex:column headerValue="Subject">
                        <apex:inputField value="{!CC.Subject}" />
                    </apex:column>
                    <apex:column headerValue="Due Date">
                        <apex:inputField value="{!CC.Date_Du__c}" />
                    </apex:column>
                </apex:dataTable>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

 

And here is the customcontroler extension

 

public class CustomController{
  Project_KA__c myProject;
  List<Case> relatedCases;
private final ApexPages.StandardController controller;
  public CustomController(ApexPages.StandardController controller){
     this.controller = controller;
     myProject= (Project_KA__c)controller.getRecord();
relatedCases = [select Id, Subject,Date_Du__c from Case where Project__c = :myProject.Id];
   }
}

 

 

I am receiving the following error on the VF page(shown in red above) and am not sure why/how to resolve.

 

Save error: Unknown property 'Project_KA__cStandardController.CustomController'

 

Any assistance would be appreciated.

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
Arvind1Arvind1

Hi,

I think u need to give the query in a method and return the values.

 

Try like this

 

public List<Case> getrelatedCases(){

relatedCases = [select Id, Subject,Date_Du__c from Case where Project__c = :myProject.Id];
return relatedCases;

}

<apex:datatable value="{!relatedCases} var="cc"> 

 
 

 

All Answers

Arvind1Arvind1

Hi,

I think u need to give the query in a method and return the values.

 

Try like this

 

public List<Case> getrelatedCases(){

relatedCases = [select Id, Subject,Date_Du__c from Case where Project__c = :myProject.Id];
return relatedCases;

}

<apex:datatable value="{!relatedCases} var="cc"> 

 
 

 

This was selected as the best answer
smagee13smagee13
Worked like a charm.

Thank you very much!