function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RajashriRajashri 

How to print the list in VF page

Hi,

I am trying to print the campaign Member List in VF page but i am getting an error that 
Unknown Property  "Unknown property 'CampaignStandardController.cm'" can anyone please help me
below is my VF page and Controller code

<apex:page StandardController="Campaign"  extensions="CampaignMemController">
    <apex:form >
        <apex:pageBlock title="Campaign Members Details" mode="maindetail">
            <apex:pageBlockSection title="Campaign Members"  id="cm3">
                <apex:pageblocktable value="{!cm}" var="com">
                        <apex:column headerValue="Name">
                            <apex:outputfield value="{!lcom.Id}" />
                        </apex:column>
    
   </apex:pageblocktable>
                      </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>
 
 
public with sharing class CampaignMemController {

    public Campaign camp {get; set; }
    list<contact> con = [SELECT id FROM contact];
    
    list<campaignmember> cmlist = [SELECT id, contactid FROM campaignmember];
    list<contact> conlist = new list<contact>();
     public CampaignMemController(ApexPages.StandardController controller) {
         camp  = (Campaign)controller.getRecord();
  
  
    for(campaignmember cm : cmlist)
{
     for(contact c : con)
    {
             if(c.id == cm.contactid)
                              conlist.add(c);
     }
    
//System.debug('All the campaignmemebers under contact '+con.name+'are'+camList );
        }  
    } 

}
 
Hargobind_SinghHargobind_Singh
What is the error message ?
RajashriRajashri
It's giving me an error that Unknown Property...

I want to print the campaign members in VF page..
Hargobind_SinghHargobind_Singh
For this line, <apex:pageblocktable value="{!cm}" var="com"> 

Use {!cmlist}, instead of {!cm}