0

I'm creating a Visualforce page to list custom objects, and select them.

When attempting to initialize a list of my wrapper class for the object I'm getting

Error: Unknown property 'Workshop_Module__cStandardController.wkshpModuleList'

I can't seem to figure out why it's going through the controller to attempt referencing the variable when it's set earlier in the class.

Controller:

public class WorkshopModuleController {

    public Workshop_Module__c thisWorkshopModule;

    public Workshop__c thisWorkshop = new Workshop__c();

    public List<WorkshopModuleWrapper> wkshpModuleList = new List<WorkshopModuleWrapper>();

    public WorkshopModuleController(ApexPages.StandardController controller) {
        this.thisWorkshopModule = (Workshop_Module__c)controller.getRecord();
        thisWorkshop.Id = thisWorkshopModule.Workshop__c;
    }

    public void getModuleList (){
        List<Module__c> modules = [SELECT Id, Name, Module_Time_In_Minutes__c FROM Module__c];
            for(Module__c modulesToAdd : modules){
                WorkshopModuleWrapper workshpModule = new WorkshopModuleWrapper(modulesToadd, thisWorkshop);
                wkshpModuleList.add(workshpModule);
            }
    }

}

Wrapper:

public class WorkshopModuleWrapper {
    public Boolean selected;
    public Workshop_Module__c workshopModule = new Workshop_Module__c();
    public String Name;

    public WorkshopModuleWrapper(Module__c module, Workshop__c workshop){
        selected = false;
        workshopModule.Module__c = module.Id;
        workshopModule.Workshop__c = workshop.Id;
        workshopModule.Name = module.Name;
        Name = module.Name;
    }

}

Visualforce Page:

<apex:page sidebar="false" showHeader="false" standardController="Workshop_Module__c" extensions="WorkshopModuleController">
  <apex:pageBlock title="Add Module(s)">
      <apex:form >
          <apex:pageBlockTable value="{!wkshpModuleList}" var="Module">
              <apex:column value="{!Module.Name}"/>
          </apex:pageBlockTable>
      </apex:form>
  </apex:pageBlock>
</apex:page>
3
  • It sounds like your within your visualforce page code, the tag does not reference to "extension" class correctly. Can you paste that part ( tag) here, for review?
    – Anshul
    Commented Apr 13, 2015 at 19:17
  • @Anshul I've added the Visualforce Page into the post. Commented Apr 13, 2015 at 19:18
  • My bad. I should have noticed it earlier. Property "public List<WorkshopModuleWrapper> wkshpModuleList
    – Anshul
    Commented Apr 13, 2015 at 19:28

1 Answer 1

2

My bad. I should have noticed it earlier. Property "wkshpModuleList" should be declared as a public property for e.g.

public List wkshpModuleList {get; set;}

2
  • Changing it to that gives me a new error: Error: Unknown property 'WorkshopModuleWrapper.Name' Commented Apr 13, 2015 at 19:41
  • 1
    same issue. Name also should be a public property. To be clear, page components can be binded to only public properties of controller.
    – Anshul
    Commented Apr 13, 2015 at 19:43

You must log in to answer this question.

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