+ Start a Discussion
Gregory512Gregory512 

Unknown property error on VF page with custom controller

I'm pulling my hair out trying to understand what's wrong here.  I'll post the VF page and the controller below.  Here's the error message I'm getting when trying to save my page:

 

Error: Unknown property 'Austin_Workshops_Controller.ICDS.Name'

 

VF Page Code:

<apex:page tabStyle="SFDC_Class__c" controller="Austin_Workshops_Controller" sidebar="false" showHeader="false" cache="false"> <apex:form > <apex:pageBlock > <apex:pageBlockTable value="{!listClass}" var="c"> <apex:column > <apex:facet name="header"> Topic </apex:facet> <apex:outputText value="{!c.Topic}" /> </apex:column> <apex:column > <apex:facet name="header"> Instructor </apex:facet> <apex:outputText value="{!c.Instructor}" /> </apex:column> <apex:column > <apex:facet name="header"> Date </apex:facet> <apex:outputText value="{!c.ICDSDate}" /> <br /><apex:outputText value="{!c.Start}" /> - <apex:outputText value="{!c.EndTime}" /> </apex:column> <apex:column > <apex:facet name="header"> Hours </apex:facet> <apex:outputText value="{!c.Hours}" /> </apex:column> <apex:column > <apex:facet name="header"> Price </apex:facet> $<apex:outputText value="{!c.Price}" /> </apex:column> <apex:column > <apex:facet name="header"> Register </apex:facet> <a href="#" onclick="openLookup('https://www.paypal.com/cgi-bin/webscr?cmd=_cart&business=support%40cdstudies%2ecom&lc=US&item_name={!c.Name}&amount={!c.Workshop_Price__c}&currency_code=USD&button_subtype=products&cn=Add%20special%20instructions%20to%20the%20seller&no_shipping=2&shipping=0%2e00&add=1&bn=PP%2dShopCartBF%3abtn_cart_LG%2egif%3aNonHosted');" ><img src="https://www.paypal.com/en_US/i/btn/x-click-but10.gif" /></a> </apex:column> </apex:pageBlockTable> </apex:pageBlock> <script> var newWindow = null; function openLookup(myurl){ if(newWindow != null){ newWindow.close(); } newWindow=window.open(myurl, 'mywindow', 'resizable=yes,scrollbars=yes,status=yes,toolbar=false,height=700,width=810'); newWindow.creator=self; } </script> </apex:form> </apex:page>

 

And the Controller Code:

 

 

public without sharing class Austin_Workshops_Controller { // public properties public List<ICDS> listClass{ get; set; } // public construcotr public Austin_Workshops_Controller(){ try{ // Initialize public list of class listClass = new List<ICDS>(); ICDS icds = new ICDS(); Date dtToday = system.today(); // Fetch all classes records for(SFDC_Class__c c : [Select Id, Name, Contact__c,Contact__r.Name, Product2__c,Product2__r.Name, CEU_Hours__c, Workshop_Price__c, Workshop_Date__c, Start_Time__c, End_Time__c From SFDC_Class__c Where Product2__r.Name = 'Austin CEU Workshop' AND Workshop_Date__c >= : dtToday Order by Workshop_Date__c Limit 1000]){ icds = new ICDS(); icds.Id = c.Id; icds.Topic = c.Name; icds.Instructor = c.Contact__r.Name; icds.Hours = string.valueof(c.CEU_Hours__c); icds.Price = string.valueof(c.Workshop_Price__c); if(c.Workshop_Date__c != null){ Date dt = c.Workshop_Date__c; icds.ICDSDate = string.valueof(dt.month()) + '/' + string.valueof(dt.day()) + '/' + string.valueof(dt.year()); } icds.Start = string.valueof(c.Start_Time__c); icds.EndTime = string.valueof(c.End_Time__c); listClass.add(icds); } } catch(Exception ex){ system.debug(ex.getMessage()); } } public class ICDS{ public string Id { get; set; } public string Topic { get; set; } public string Instructor { get; set; } public string Hours { get; set; } public string Price { get; set; } public string ICDSDate { get; set; } public string Start { get; set; } public string EndTime { get; set; } } }

 

 

I appreciate any help.  Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

You've got a couple of references to {!c.name} in there.

 

c is the var of your pageBlockTable, whose value is a List<ICDS>, so c is an ICDS object.

 

Your inner ICDS class doesn't have a property called "Name" on it.

All Answers

jwetzlerjwetzler

You've got a couple of references to {!c.name} in there.

 

c is the var of your pageBlockTable, whose value is a List<ICDS>, so c is an ICDS object.

 

Your inner ICDS class doesn't have a property called "Name" on it.

This was selected as the best answer
Gregory512Gregory512
I completely missed the problem references in the link code.. thanks for your help.
jwetzlerjwetzler
By the way, check out the headerValue attribute on apex:column, if you're interested in getting rid of some of those header facets.