You need to sign in to do that
Don't have an account?
Uday Kiran 109
When i'm trying to execute below it's showing{Error: Compile Error: Variable does not exist: name at line 8 column 9} please help me out.
Class:
public class ListExample3 {
public string name{set;get;}
public string industry{set;get;}
public string phone{set;get;}
public ListExample3(){
List<Account>accs=new List<Account>();
Account a1=new Account();
a1.name='Wipro';
a1.industry='Information Technology';
a1.phone='123';
accs.add(a1);
Account a2=new Account();
a2.name='TCS';
a2.industry='Banking';
a2.phone='123';
accs.add(a2);
}
}
VF page:
<apex:page controller="ListExample3">
<apex:form>
<apex:pageBlock title="Account">
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.industry}"/>
<apex:column value="{!a.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
public class ListExample3 {
public string name{set;get;}
public string industry{set;get;}
public string phone{set;get;}
public ListExample3(){
List<Account>accs=new List<Account>();
Account a1=new Account();
a1.name='Wipro';
a1.industry='Information Technology';
a1.phone='123';
accs.add(a1);
Account a2=new Account();
a2.name='TCS';
a2.industry='Banking';
a2.phone='123';
accs.add(a2);
}
}
VF page:
<apex:page controller="ListExample3">
<apex:form>
<apex:pageBlock title="Account">
<apex:pageBlockTable value="{!accs}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.industry}"/>
<apex:column value="{!a.phone}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
try this code create accs as a public property and then use it in vf page
I hop it helps you
Mark it best answer if it helps you
Thanks
Thanks