
Hey Naveen, Paste below code-
<apex:page standardController="Lead" Extensions="DisplayingListofrecords_Controller">
<apex:form id="theform">
<apex:pageBlock title="For buttons">
<apex:commandButton action="{!ShowLeads}" value="Show Leads" reRender="theform"/>
<apex:actionStatus startText="Requesting............"></apex:actionStatus>
<apex:pageBlock title="Displaying List of accounts" id="Showlistofleads" rendered="true">
<apex:dataTable value="{!leadlist}" var="a" cellpadding="4" border="1">
<apex:column >
<apex:facet name="header">Name</apex:facet>
{!a.Name}
</apex:column>
<apex:column >
<apex:facet name="header">Company</apex:facet>
{!a.Company}
</apex:column>
<apex:column >
<apex:facet name="header">Status</apex:facet>
{!a.Status}
</apex:column>
<apex:column >
<apex:facet name="header">Industry</apex:facet>
{!a.Industry}
</apex:column>
<apex:column >
<apex:facet name="header">Email</apex:facet>
{!a.Email}
</apex:column>
<apex:column >
<apex:facet name="header">LeadSource</apex:facet>
{!a.LeadSource}
</apex:column>
<apex:column >
<apex:facet name="header">Lead Score</apex:facet>
{!a.Lead_Score__c}
</apex:column>
</apex:dataTable>
</apex:pageBlock>
</apex:pageBlock>
</apex:form>
</apex:page>
Hit Best answer if it resolved your issue.Happy Coding.public with sharing class DisplayingListofrecords_Controller {
Public List<Lead> leadlist {get;set;}
public DisplayingListofrecords_Controller(ApexPages.StandardController controller) {
}
public PageReference ShowLeads()
{
leadlist = [select Name,Company,Status,Industry,Email,LeadSource from lead];
return null;
}
}
4 respuestas