You need to sign in to do that
Don't have an account?
deepak balur 19
VisualForce Error: Unknown Property error
Keep getting the error unknown property: AccountController.DisplayAccount.operations_status__c
Have a page block as follows:
<apex:pageBlockTable title="Account" value="{!Accntlist}" var="Accnts">
<apex:column headerValue="Id" value="{!Accnts.Id}" />
<apex:column headerValue="Name" value="{!Accnts.Name}" />
<apex:column headerValue="Status" value="{!Accnts.Operations_Status__c}" />
</apex:pageBlockTable>
Controller so far is at:
public class AccountController {
public Static List<DisplayAccount> getAccntlist() {
List <DisplayAccount> Accntlist = new List<DisplayAccount>();
for (Account A : [SELECT Id, Name,Operations_Status__c FROM Account]){
Accntlist.add(new DisplayAccount(A));
}
return Accntlist;
}
public class DisplayAccount{
private Account VAccnt;
public DisplayAccount(Account A) {
this.VAccnt = A;
}
public String ID {
get { return VAccnt.Id; }
}
public String Name {
get { return VAccnt.Name; }
}
public String Status {
get { return VAccnt.Operations_Status__c; }
}}//End of Class Display Account
public PageReference addToCart() {
return null;
}//End of AddtoCart
}//End of Class
Have a page block as follows:
<apex:pageBlockTable title="Account" value="{!Accntlist}" var="Accnts">
<apex:column headerValue="Id" value="{!Accnts.Id}" />
<apex:column headerValue="Name" value="{!Accnts.Name}" />
<apex:column headerValue="Status" value="{!Accnts.Operations_Status__c}" />
</apex:pageBlockTable>
Controller so far is at:
public class AccountController {
public Static List<DisplayAccount> getAccntlist() {
List <DisplayAccount> Accntlist = new List<DisplayAccount>();
for (Account A : [SELECT Id, Name,Operations_Status__c FROM Account]){
Accntlist.add(new DisplayAccount(A));
}
return Accntlist;
}
public class DisplayAccount{
private Account VAccnt;
public DisplayAccount(Account A) {
this.VAccnt = A;
}
public String ID {
get { return VAccnt.Id; }
}
public String Name {
get { return VAccnt.Name; }
}
public String Status {
get { return VAccnt.Operations_Status__c; }
}}//End of Class Display Account
public PageReference addToCart() {
return null;
}//End of AddtoCart
}//End of Class
In your code, there is no direct relationship from DisplayAccount to Operation_Status__c. However, you set the Operation_Status__c to Status property. So, in your Visualforce, you can call either:
<apex:column headerValue="Status" value="{!Accnts.Status}" />
or
<apex:column headerValue="Status" value="{!Accnts.VAccnt.Operations_Status__c}" />
All Answers
In your code, there is no direct relationship from DisplayAccount to Operation_Status__c. However, you set the Operation_Status__c to Status property. So, in your Visualforce, you can call either:
<apex:column headerValue="Status" value="{!Accnts.Status}" />
or
<apex:column headerValue="Status" value="{!Accnts.VAccnt.Operations_Status__c}" />
For ex:
private Account VAccnt;
to
public Account VAccnt;