+ Start a Discussion
sfdc freshersfdc fresher 

i want to set the heading of 3 columns of data

i want to print the account names in 3 columns(3 differnt types of accounts) , i need to add the heading to those columns like Accoun1..Account 2 and Account 3, and need to disply the in columns. kindly help me how to achieve this. 

controller logic:
public class DisplayRecordsDatewise {

        List<Account> act1;
        List<Account> act2;
        List<Account> act3;
    public List<Account> getAccounts1()
    {
        act1=[select id,name from Account where createdDate!=Yesterday limit 10];
        return act1;
     }
     public List<Account> getAccounts2()
    {
        act2=[select id,name from Account where createdDate!=Last_WEEK limit 10];
        return act2;
     }
     public List<Account> getAccounts3()
    {
        act3=[select id,name from Account where createdDate=LAST_N_DAYS:120];
        RETURN act3;
     }
    
}
vf logic:
<apex:page controller="DisplayRecordsDatewise">
    <apex:form >
    <apex:pageblock >
        
        <apex:pageBlockSection columns="3">
           
             <apex:dataList value="{!Accounts1}" var="a">
                <apex:outputText value="{!a.name}" />
            </apex:dataList>
            <apex:dataList value="{!Accounts2}" var="a">
               <apex:outputText value="{!a.name}" />
            </apex:dataList>
           <apex:dataList value="{!Accounts3}" var="a">
                <apex:outputText value="{!a.name}" />
            </apex:dataList>
         </apex:pageBlockSection>
      </apex:pageBlock>
   </apex:form>
</apex:page>
Raj VakatiRaj Vakati
Try this page 
 
<apex:page controller="DisplayRecordsDatewise">
    <apex:form >
        <apex:pageblock >
            
            <apex:pageBlockSection columns="3">
                <apex:dataTable value="{!Accounts1}" var="account" id="theT234234able"
                                rowClasses="odd,even" styleClass="tableClass">
                    <apex:column>
                        <apex:facet name="header">Accounts1</apex:facet>
                        <apex:outputText value="{!account.name}"/>
                    </apex:column>
                    
                </apex:dataTable>
                <apex:dataTable value="{!Accounts2}" var="account" id="theTab12234le"
                                rowClasses="odd,even" styleClass="tableClass">
                    <apex:column>
                        <apex:facet name="header">Accounts2</apex:facet>
                        <apex:outputText value="{!account.name}"/>
                    </apex:column>
                    
                </apex:dataTable>
                <apex:dataTable value="{!Accounts3}" var="account" id="theTabl12e"
                                rowClasses="odd,even" styleClass="tableClass">
                    <apex:column>
                        <apex:facet name="header">Accounts3</apex:facet>
                        <apex:outputText value="{!account.name}"/>
                    </apex:column>
                    
                </apex:dataTable>
                
                
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>