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
Ethan WestEthan West 

Error: Unknown property 'pse_Assignment_cStandardController.listAssignment'

Hi All,

I was working off the recommendation of a separate user's piece for a mass create feature that adds additional rows.

I've attempted bastardising their work and adding mine splintered into it, I now have the Apex Code Controller saved as such;
public class AddmultipleAssignmentController {

    public pse__Assignment__c del;
    public List<pse__Assignment__c> TC {get; set;}
    public List<pse__Assignment__c> delTCList {get; set;}
    public List<pse__Assignment__c> AssignmentList {get; set;}
    public Integer rowIndex {get; set;}

    public AddmultipleAssignmentController(ApexPages.StandardSetController controller) {
        pse__Assignment__c a = new pse__Assignment__c();
        AssignmentList = new List<pse__Assignment__c>();
        AssignmentList.add(a);
        
        delTCList = new List<pse__Assignment__c>();
        TC = new List<pse__Assignment__c>();
        
    }
    
    public void addRow(){
        pse__Assignment__c a = new pse__Assignment__c();
        AssignmentList.add(a);
    }
    
    public PageReference save(){
        for(pse__Assignment__c s2 : AssignmentList){
            TC.add(s2);
            
             return Page.Allassignmentsaved;
            
        }
        insert TC;
        AssignmentList.clear();
        addRow();
        return null;
    }
    
    public void deleteRow(){
        rowIndex = Integer.valueOf(ApexPages.currentPage().getParameters().get('rowIndex'));
        del = AssignmentList.remove(rowIndex);
        delTCList.add(del);
        

    }
}
but when trying to save the referencing VisualForce Code;
<apex:page standardController="pse__Assignment__c" recordSetVar="unused" extensions="AddmultipleAssignmentController" >
<apex:enhancedList type="pse__Assignment__c" height="300" rowsPerPage="10" id="ListViewID"/>
    <apex:form>
    
        <apex:pageBlock title="Assignments" id="pb">
            <apex:variable var="rowNumber" value="{!0}"/>
            <apex:pageblockSection columns="1">
            <apex:pageBlockTable title="Assignments" value="{!listAssignment}" var="TC">
            
                <apex:column headerValue="No." style="width:20px; text-align:center;" headerClass="centertext">
                        <apex:outputText value="{0}" style="text-align:center;">
                            <apex:param value="{!rowNumber+1}"/>
                        </apex:outputText>
                </apex:column>
                        
                <apex:column headerValue="Assignment Name">
                    <apex:inputField value="{!TC.Name}"/>
                </apex:column>
                
                <apex:column headerValue="Resource">
                    <apex:inputField value="{!TC.pse__Resource__c}"/>
                </apex:column>
                
                <apex:column headerValue="Project">
                    <apex:inputField value="{!TC.pse__Project__c}"/>
                </apex:column>
                
                <apex:column headerValue="Candidate">
                    <apex:inputField value="{!TC.Candidate__c}"/>
                </apex:column>
                
                <apex:column headerValue="Bill Rate">
                    <apex:inputField value="{!TC.pse__Bill_Rate__c}"/>
                </apex:column>    
                
                <apex:column headerValue="Start Date">
                    <apex:inputField value="{!TC.Start_Date__c}"/>
                </apex:column>
                
                <apex:column headerValue="End Date">
                    <apex:inputField value="{!TC.End_Date__c}"/>
                </apex:column>
                
                <apex:column headerValue="Monday Hours">
                    <apex:inputField value="{!TC.Monday_Hours__c}"/>
                </apex:column>
                
                <apex:column headerValue="Tuesday Hours">
                    <apex:inputField value="{!TC.Tuesday_Hours__c}"/>
                </apex:column>
                
                <apex:column headerValue="Wednesday Hours">
                    <apex:inputField value="{!TC.Wednesday_Hours__c}"/>
                </apex:column>
                
                <apex:column headerValue="Thursday Hours">
                    <apex:inputField value="{!TC.Thursday_Hours__c}"/>
                </apex:column>
                
                <apex:column headerValue="Friday Hours">
                    <apex:inputField value="{!TC.Friday_Hours__c}"/>
                </apex:column>                       
                
                <apex:column headerValue="Saturday Hours">
                    <apex:inputField value="{!TC.Saturday_Hours__c}"/>
                </apex:column>                             
                
                <apex:column headerValue="Sunday Hours">
                    <apex:inputField value="{!TC.Sunday_Hours__c}"/>
                </apex:column>
                
                <apex:column headerValue="Action">
                    <apex:commandButton value="Delete Row" action="{!deleteRow}" reRender="pb"/>
                        <apex:param name="rowIndex" value="{!rowNumber+1}"/>
                </apex:column>
                
            </apex:pageBlockTable>
            
                    <apex:commandButton action="{!addRow}" value="Add Assignment" rerender="pb"/>
            </apex:pageblockSection>
                <apex:pageBlockButtons>
                    <apex:commandButton value="Save" action="{!save}"/>
                    <apex:commandButton value="Cancel" action="{!cancel}"/>
                </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

I get the error;

Error: Unknown property 'pse__Assignment__cStandardController.listAssignment'

I can't see where I have referenced this; could anyone please advise?
 

Kind regards,

Ethan
 

Nayana KNayana K
<apex:pageBlockTable title="Assignments" value="{!listAssignment}" var="TC">

 
Ethan WestEthan West
Thank you for pointing it out, I've tried a couple things but can't seem to get the error to prompt.

Do you know at all how to fix this error as I can't seem to get around it whilst relating to the controller?
Nayana KNayana K
<apex:pageBlockTable title="Assignments" value="{!AssignmentList}" var="TC">
If I am not wrong, AssignmentList is the list holding what to display. Please change accordingly