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
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>
<apex:column value="{!a.acc.name}"/>
<apex:column value="{!a.acc.phone}"/>
</apex:pageBlockTable>

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

</apex:form>
</apex:page>

and my class:

public class accountcontactwraper {

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


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
Try
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:column>
 <apex:inputCheckbox value="{!c.select}"/>