Wednesday, 19 November 2014

Using custom label in visualforce page

A custom label can used to store a desired text value of length up to 1000. A 
custom label value can then be referenced by apex code or visualforce page. A 
custom label can store values of length up to 1000 characters in it. We can have 
a total of 5000 custom labels in an org.
Create a custom label by navigating to set up -> create -> custom label

In the below example let us see how we can access the custom label in visualforce 
page directly.

Visualforce page that accesses the custom label 

<apex:page controller="custlabelcontroller">
   <apex:form >
     <apex:pageblock >
       Value stored in custom label is: {!$Label.category}
     </apex:pageblock>
   </apex:form>

</apex:page>


No comments:

Post a Comment