+ Start a Discussion
Ranadheer chRanadheer ch 

i created vf page for dispalying account list one side and contact list other side by using the wraper class

i created vf page for dispalying account list one side and contact list other side seperate by using the wraper class (i dont know weather i can use two wraper classes in one class or not ) here is vf page

vf page :
<apex:page controller="accountcontactwraper" sidebar="false" >
<apex:form >
<apex:commandButton value="save"/>
<apex:pageBlock >
<apex:pageBlockSection collapsible="false" columns="2">

<apex:pageBlockTable value="{!Accounttable}" var="a">
<apex:column >
<apex:inputCheckbox value="{!a.selected}"/>
<apex:column value="{!a.acc.name}"/>
<apex:column value="{!a.acc.phone}"/>

<apex:pageBlockTable value="{!contacttable}" var="C">
 <apex:inputCheckbox value="{!c.select}"/>
<apex:column value="{!a.con.name}"/>
<apex:column value="{!a.con.phone}"/>


and my class:

public class accountcontactwraper {

  public List<accountcontactwrapercreate> Accounttable{get;set;}
  public string contacttable{get;set;}
 public accountcontactwraper (){
 Accounttable=New LIst<accountcontactwrapercreate>();
 for(Account accs:[select id,name,phone from account limit 10]){
 Accounttable.add(New accountcontactwrapercreate(accs) );
 contacttable=New List<wrapercon>();
 for(contact cc:[select id,name,lastname from contact limit 10]){
 contacttable.add(New wrapercon(cc));
 public class accountcontactwrapercreate{
 public Account acc{get;set;}
 public boolean selected{get;set;}
    public accountcontactwrapercreate(Account a){
 public class wrapercon{
 public contact con{get;set;}
 public boolean select{get;set;}
    public wrapercon(contact c){

now while saving this class am getting this error :
 accountcontactwraper Compile Error: unexpected token: 'select' at line 35 column 16

Help me thanks  in advance
Roy LuoRoy Luo
public List<wrapercon> contacttable{get;set;}

Continue reading if you want to know why you gets the error.

The controller defines contacttable as string:
​  public string contacttable{get;set;}
And the table uses contacttable as binding data source and the checkout is bound to 'select' of contacttable: Of course 'select' is not defined for a string type contacttable.
<apex:pageBlockTable value="{!contacttable}" var="C">
 <apex:inputCheckbox value="{!c.select}"/>