You need to sign in to do that
Don't have an account?
Nitish Kulkarni
Unknown property error in VF page using custom controller
Unknown property 'select_rec_condition_class.pos1' error in VF page
Controller
<!-- Select record on conditions class --> <apex:page showHeader="false" controller="select_rec_condition_class"> <apex:form> <apex:pageBlock> <center> <apex:commandButton value="LowSalary" action="{!LessSalary}"/> <apex:commandButton value="HighSalary" action="{!MoreSalary}"/> </center> <font color="red" size="4"><br/> Position records whose minpay is less than or equal to 2000 </font><br/> <apex:pageBlockTable value="{!pos1}" var="ps1"> <apex:column value="{!ps1.Name}"/> <apex:column value="{!ps1.Location__c}"/> <apex:column value="{!ps1.Min_Pay__c}"/> <apex:column value="{!ps1.Max_Pay__c}"/> <apex:column value="{!ps1.Open_Date__c}"/> <apex:column value="{!ps1.Cloe_Date__c}"/> <apex:column value="{!ps1.Status__c}"/> </apex:pageBlockTable> <br/><br/> <font color="blue" size="4"> Position records whose minpay is greater than 2000 </font><br/> <apex:pageBlockTable value="{!pos2}" var="ps2"> <apex:column value="{!ps2.Name}"/> <apex:column value="{!ps2.Location__c}"/> <apex:column value="{!ps2.Min_Pay__c}"/> <apex:column value="{!ps2.Max_Pay__c}"/> <apex:column value="{!ps2.Open_Date__c}"/> <apex:column value="{!ps2.Cloe_Date__c}"/> <apex:column value="{!ps2.Status__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>
Controller
//Select record on conditions class public class select_rec_condition_class { List<Position__c> pos1{get;set;} public void LessSalary() { pos1 = [select Name,Location__c,Min_Pay__c,Max_Pay__c,Open_Date__c,Close_Date__c, Status__c from Position__c where Min_Pay__c <= 2000]; } List<Position__c> pos2{get;set;} public void MoreSalary() { pos2 = [select Name,Location__c,Min_Pay__c,Max_Pay__c,Open_Date__c,Close_Date__c, Status__c from Position__c where Min_Pay__c > 2000]; } }
Also fix the typos in your visualforce page, on lines 19 and 32. It should be Close_Date__c not Cloe_Date__c.
Below is the visualforce page, only change is the corrected typos.
All Answers
Also fix the typos in your visualforce page, on lines 19 and 32. It should be Close_Date__c not Cloe_Date__c.
Below is the visualforce page, only change is the corrected typos.