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
Matt EckMatt Eck 

Trouble with Wrappers - Unknown property 'VisualforceArrayList.GiverId'

I'm trying to write a visualforce page that will display badge information when given a recipient ID number. I need to use a wrapper class otherwise I would need 2 values going into my pageBlockTable values.

Everything on the Apex side seems to be working fine but when I try to access the information from visualforce I get this error "Unknown property 'VisualforceArrayList.GiverId'".

Apex Class:
public with sharing class GetBadges {
    public List<BadgeWrapper> Wrappers { get; set; }
    public class BadgeWrapper 
    {
        public List<WorkBadge> Results {get; set;}
    	public String GID {get; set;}
    	public List<User> Results2 {get; set;}
        public BadgeWrapper(List<WorkBadge> wl, String g, List<User> ul)
        {
            Results = wl;
            GID = g;
            Results2 = ul;
        }
    }
    
    public GetBadges()
    {
        Wrappers = new List<BadgeWrapper>();
        List<WorkBadge> wl = [SELECT GiverId, Message, ImageURL, Description, DefinitionId FROM WorkBadge WHERE RecipientId = '00536000002UKV1'];
        String g = String.valueOf(wl[0]);
        List<User> ul = [SELECT Name FROM User WHERE ID = :g];
        Wrappers.add(new BadgeWrapper(wl,g,ul));
    }
}

Visualforce Page:
<apex:pageBlock title="Badge Certificate">
	<apex:pageBlockTable value="{!Wrappers}" var="row"> 
		<apex:column > 
                          <!--apex:facet name="giverID">Giver's ID</apex:facet--> 
                         <apex:outputText value="{!row.Results.GiverId}"/> 
		</apex:column> 
        </apex:pageBlockTable>
</apex:pageBlock>
I'm not sure why I'm getting this error any help would be really appreciated. Thanks!

 
JeffreyStevensJeffreyStevens
I think line #20 should be...

String g = String.valueOf(wl[0].GiverId);

and then line #5 of the VF should be 
<apex:otuputText value="{!row.results.GID}" />
Matt EckMatt Eck
I tried changing these two options and changing 
String g = String.valueOf(wl[0]);
to
String g = String.valueOf(wl[0].GiverId);
didn't throw any errors but now with 
<apex:otuputText value="{!row.results.GID}" />
I'm getting the error "Unknown property 'VisualforceArrayList.GID'" instead of "Unknown property 'VisualforceArrayList.GiverId'"
Matt EckMatt Eck
I got it!
I had to put the row number in the visualforce page so it should have been 
<apex:column > 
       <apex:facet name="giverID">Giver's ID</apex:facet> 
       <apex:outputText value="{!row.Results[0].GiverId}"/> 
</apex:column>
now I'll just need to put these in a repeater and I should be all set. Thanks for the help!