Currency format in Visualforce page

Sample Code:

Visualforce page:

<apex:page extensions="Sample" standardController="Employee__c">
<apex:pageBlock >
    <apex:pageBlockSection columns="1">
        <apex:outputText value="${0, number, ###,###,###,##0.00}">
            <apex:param value="{!a}" />
        </apex:outputText>
        <apex:outputText value="${0, number, ###,###,###,##0.00}">
            <apex:param value="{!b}" />
        </apex:outputText>
        <apex:outputText value="${0, number, ###,###,###,##0.00}">
            <apex:param value="{!c}" />
        </apex:outputText>
    </apex:pageBlockSection>
</apex:pageBlock>

</apex:page>

Apex Class:

public class Sample {
    public Decimal a {get;set;}
    public Decimal b {get;set;}
    public Decimal c {get;set;}
    
    public Sample(ApexPages.StandardController controller) {
        a = 1800.00;
        b = 200;
        c = 34567.09;
    }

}

Output:




Sample Code:

Visualforce page:

<apex:page controller="Sample">
<apex:outputLabel value="The value is : "/>
<apex:outputText value="{0, number, currency}">
    <apex:param value="{!inte}"/>
</apex:outputText>
</apex:page>


Apex Controller:

public class Sample { 
    public Decimal inte {get;set;}
    public Sample() {
        inte = 098.23;
    }         
}


Output:


No comments:

Post a Comment