ads

Thursday, 28 July 2016

How To Show Total No Of Reords in PageBlockTable





Controller Code :-


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
public class TotalContacts
{
 public String obj;
    public List<Contact> ContactList{get;set;}
    
    public TotalContacts() 
    {    
        ContactList= [SELECT ID, Name,lastname,email FROM Contact order by createddate limit 10];
    }   

}

Visualforce Page Code:-


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
<apex:page controller="TotalContacts">

<apex:pageblock Title="List of Contacts">
      
         <apex:pageBlock >
        <apex:pageblockTable value="{!ContactList}" var="u">
            <apex:column headerValue="Contact Name">
                <apex:outputLink value="/{!u.id}">{!u.Name}</apex:outputLink>
            </apex:column>
            
            <apex:column headerValue="Contact Email">
                <apex:outputLink value="/{!u.id}">{!u.Email}</apex:outputLink>
            </apex:column>
        </apex:pageblockTable>
    </apex:pageblock>  

    </apex:pageBlock> 

</apex:page>

OutPut Screen :-



No comments:

Post a Comment