You need to sign in to do that
Don't have an account?
Austin Mayerhofer
Display VF content based on if statement?
Hi all,
I'm trying to display a table of values on my VF page based on if I have 1 or more objects in the backend for a custom object pending_food__c. If there's pending_food__c objects that exist, display a table, if there's not, don't display a table.
For example, I'm trying to achieve this by doing:
I'm trying to display a table of values on my VF page based on if I have 1 or more objects in the backend for a custom object pending_food__c. If there's pending_food__c objects that exist, display a table, if there's not, don't display a table.
For example, I'm trying to achieve this by doing:
<apex:pageBlockSectionItem rendered="{![SELECT Id FROM pending_food__c].size() > 0}"> </apex:pageBlockSectionItem>But I'm getting " Syntax error. Missing '=' ". How can I implement the functionality of displaying based on whether there's pending_food__c's in the backend?
It is not allowed to do the query on a VF page. You should use a controller class for this VF page and than execute the SOQL in this class:
Consider the below example:
Let me know if you need any further help on this.
Thanks,
Abhishek Bansal.
Gmail: abhibansal2790@gmail.com
Skype: abhishek.bansal2790
Phone: +917357512102