How to include number of records in button name in Visualforce Page?

Sample Code:

Visualforce page:

<apex:page controller="SampleController">
<apex:form >
    <apex:pageBlock >
        <apex:pageBlockTable value="{!empList}" var="e">
            <apex:column value="{!e.Name}"/>
        <apex:pageBlockButtons >            
            <apex:commandButton value="Convert All {!empCount} Records"/>

Apex Controller:

public class SampleController {
    public List<Employee__c> empList {get;set;}
    public Integer empCount {get;set;}
    public SampleController() {
        empList = [SELECT Id, Name FROM Employee__c];
        empCount = empList.size();


No comments:

Post a Comment

Sharing is Caring!!! Share this with your friends!!!

submit to reddit