You need to sign in to do that
Don't have an account?
Oldwen 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
taskList.add(t);
}
}
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
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
taskList.add(t);
}
}
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
Check below example will help you .
https://developer.salesforce.com/page/Wrapper_Class
Basically you need to create a list of wrapper class and display in page .
Let me know if it helps !!
Thnaks
Manoj
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
http://www.forcexplore.com/2014/07/wrapper-class-in-salesforce.html
https://www.interactiveties.com/blog/2012/visualforce-wrapper-class.php#.VYj30M1Viko
Hope this helps! Mark it as solution if this solves your problem.
Regards,
Eswar Prasad.
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:
This is my VS page:
This seems relatively straightfoward... can someone please help me?
Thanks,
Oldwen