How to display Custom Setting data using Apex in Visualforce page?
Sample Code:
Visualforce Page:
<apex:page controller="sample" sidebar="false" >
<apex:form >
<apex:pageblock >
<apex:pageblockTable value="{!code}" var="c">
<apex:column value="{!c.Name}"/>
<apex:column value="{!c.Code__c}"/>
</apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Visualforce Page:
<apex:page controller="sample" sidebar="false" >
<apex:form >
<apex:pageblock >
<apex:pageblockTable value="{!code}" var="c">
<apex:column value="{!c.Name}"/>
<apex:column value="{!c.Code__c}"/>
</apex:pageblockTable>
</apex:pageblock>
</apex:form>
</apex:page>
Apex Controller: public class sample { public List<CountryCodes__c> code {get;set;} public sample() { Map<String,CountryCodes__c> allCodes = CountryCodes__c.getAll(); code = allCodes.values(); } } Output: |
No comments:
Post a Comment