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
apexcodeapexcode 

wrapper classes

what are the wrapper classes when are we going to use these warapper.is it neccasary to use everytime when we create a custome controller.

Rajesh_ShahRajesh_Shah

It is not necessary to use a wrapper class everytime you create a custom controller.

 

For more details regarding wrapper classes, read the wrapper class post on wiki.

http://wiki.developerforce.com/page/Wrapper_Class

Rahul SharmaRahul Sharma

Wrapper classes are used to bind different datatype's together.

A pageblock table with checkboxes is an example.

AshlekhAshlekh

Hi ,

 

Good question.

I am giving you a small examle.

eg. suppose i have a object and want to show all record on page so i will get all record into a  list and to show this list on page by pageblocktable  and i need to show a another variable value with each record which are not related to this object and dont have any relationship but show status for that record is selected or not. We know we can bind a single variable pageblock table so for this we make a wrapper class. This wrapper class contain the instance of  the object and value of extra variable which is using along with each record and make a list of intance of this wrapper class and we will bind this wrapper class instance with page block table.

 

thank

crop1645crop1645

Wrapper classes are also used when you want to write your own methods on SObjects