You need to sign in to do that
Don't have an account?
Aman Kumar 196
I wrote the below code, and getting the Unknown property "'SearchAccount_ctrl.AccList'" Error.
public class SearchAccount_ctrl {
public string city{get;set;}
public Boolean show{get;set;}
public integer size{get;set;}
List<Account> AccList{get;set;}
Public SearchAccount_ctrl()
{
Size=0;
Show=False;
AccList=new List<Account>();
}
Public void Search()
{
AccList=[Select id,Name,Rating,Industry From Account where Billingcity=:city];
Size= AccList.size();
If(size>0)
{
show=true;
}
else
{
show=false;
}
}
}
=======================
VF Page:
<apex:page controller="SearchAccount_ctrl">
<apex:form>
<apex:pageBlock>
<apex:pageblocksection >
<apex:outputLabel id="a1">
<apex:pageblocktable title='Search Result' value="{!AccList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Billingcity}"/>
<apex:column value="{!item.Rating}"/>
<apex:column value="{!item.Industry}"/>
</apex:pageblocktable>
</apex:outputLabel>
</apex:pageblocksection>
<apex:commandButton title="Search" action="{!Search}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
public string city{get;set;}
public Boolean show{get;set;}
public integer size{get;set;}
List<Account> AccList{get;set;}
Public SearchAccount_ctrl()
{
Size=0;
Show=False;
AccList=new List<Account>();
}
Public void Search()
{
AccList=[Select id,Name,Rating,Industry From Account where Billingcity=:city];
Size= AccList.size();
If(size>0)
{
show=true;
}
else
{
show=false;
}
}
}
=======================
VF Page:
<apex:page controller="SearchAccount_ctrl">
<apex:form>
<apex:pageBlock>
<apex:pageblocksection >
<apex:outputLabel id="a1">
<apex:pageblocktable title='Search Result' value="{!AccList}" var="item">
<apex:column value="{!item.Name}"/>
<apex:column value="{!item.Billingcity}"/>
<apex:column value="{!item.Rating}"/>
<apex:column value="{!item.Industry}"/>
</apex:pageblocktable>
</apex:outputLabel>
</apex:pageblocksection>
<apex:commandButton title="Search" action="{!Search}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Try adding public.
All Answers
Try adding public.
Did you try what I suggested? If so, did it work?
Or did you do something else that worked?
Or do you still have the problem?
Please update.
Thanks!