+ Start a Discussion
Oldwen AdrianoOldwen Adriano 

Wrapper class on a VS page

Need some assistance with a Wrapper class on a VS pageI am attempting to create a VF page using a wrapper class, but I keep running into errors.  I have broken down my attempt to the most basic level to simply try to gain understanding.

Here is my class:

global class ControllerGetNext {

//Our collection of the class/wrapper objects Tasks

public List taskList {get; set;}

//This method uses a simple SOQL query to return a List of Tasks

public List getTasks()


if(taskList == null)


taskList = new List();

for(Task t: [Select ID, Subject, ActivityDate, Due_Time__c, Description from Task])


// As each contact is processed we create a new Task object and add it to the taskList




return taskList;


// This is our wrapper/container class. A container class is a class, a data structure, or an abstract data type whose instances are collections of other objects.

//In this example a wrapper class contains both the standard salesforce object Contact and a Boolean value

public class tTask


public Task tTask {get; set;}

//This is the contructor method. When we create a new tTask object we pass a Task that is set to the t property. We also set the selected value to false

public tTask(Task t) {

tTask = t;




Here is my VF page

Lead Name

HI Oldwen,

Check below  example will help you .


Basically you need to create a list of wrapper class and display in page .

Let me know if it  helps !!

Eswar Prasad@Sfdc11Eswar Prasad@Sfdc11
HI Oldwen Adriano,

Wrapper class define binding multiple sobject and display multiple sobject records  in visualforce page. I will provide you example pls see below link we get idea



Hope this helps! Mark it as solution if this solves your problem.

Eswar Prasad.

Oldwen AdrianoOldwen Adriano
Hello and thank you for the replies:   I have a basic concept of how to create the wrapper class and make it work, but I keep running into an error that is likely simply, but I am not sure why I am encountering it...

Error: Unknown property 'ControllerGetNext.lstWrapperString'   ---- this is the error I am getting.

In my page it calls the lstWrapperString class...

The code is in fact in my Apex class, so I do not understand why I am getting this error...

Let me readd my Apex class:
global class ControllerGetNext {

   List tList = new List();
   List lstw = new List();
   Public List lstWrapperString()
        tList = [Select ID, Subject, ActivityDate, Due_Time__c, Description from Task];
        for(integer i=0; i < tList.size(); i++)
            lstw.add(new wrapper(tList[i].ID, tList[i].Subject, tList[i].ActivityDate, tList[i].Due_Time__c, tList[i].Description));
        return lstw;    
   //Create my wrapper class... like an ENUM
   Public class wrapper
    public string tID{get;set;}
    public string tSubject{get;set;}
    public datetime tActivityDate{get;set;}
    public string tDueTime{get;set;}
    public string tDescription{get;set;}
    public wrapper(string tID, string tSubject, datetime tActivityDate, string tDueTime, string tDescription)
        this.tID = tID;
        this.tSubject = tSubject;
        this.tActivityDate = tActivityDate;
        this.tDueTime = tDueTime;
        this.tDescription = tDescription;

This is my VS page:


              Lead Name

This seems relatively straightfoward... can someone please help me?



Oldwen AdrianoOldwen Adriano
The HTML for my VS page will not post... trying again...

User-added image