
1 respuesta

Hi,Please check the below sample code.Apex Class
VisualForce Page:public with sharing class CampaginList {
public List<Campaign> listcamp { get; set; }
public CampaginList(){
listcamp= new List<Campaign>();
listcamps();
}
public List<Campaign> listcamps(){
listcamp=[select id, name ,StartDate,EndDate from Campaign limit 5];
return listcamp;
}
}
Output:<apex:page controller="CampaginList">
<apex:form >
<apex:pageBlock >
<apex:pageBlockTable value="{!listcamp}" var="c">
<apex:column headerValue="Name">
<apex:outputfield value="{!c.name}"/>
</apex:column>
<apex:column headerValue="StartDate">
<apex:outputfield value="{!c.StartDate}"/>
</apex:column>
<apex:column headerValue="EndDate">
<apex:outputfield value="{!c.EndDate}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
Let me know if you need any help!Best Regards,Jyothsna