Skip to Content

TheBlogReaders.com

Salesforce.com, PHP, MySQL, Javascript, Ajax, Htacces

How to access custom labels dynamically in visualforce page?

Be First!

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()
{
mylabel=’CustomLabelName‘;
}
}

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

(0)

Previous
Next

Leave a Reply