You need to sign in to do that
Don't have an account?
Ranadheer 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
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
Continue reading if you want to know why you gets the error.
The controller defines contacttable as string: 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.