How to access custom labels dynamically in visualforce page?

No, you can’t reference labels dynamically in apex.
However, you can reference them dynamically from visualforce so you can put them on the page like so:

Apex Class:
public class MyController
public String mylabel{get; set;}

public MyController()

Visualforce Page:
<apex:page Controller=”MyController”>
<apex:outputText> {!$Label[mylabel]} </apex:outputText>

Written by 

3x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

Your email address will not be published.