+ Start a Discussion
tulasiram chtulasiram ch 

Can anyone hel me in the below page code

Hi i developed below page for displaying childs of account in the page. But when i click on child record tab it refreshing all the page. But i don't want that to full page refresh . Help out please

Page: <apex:page controller="ApexController" tabStyle="account">
    <apex:pageBlock mode="Edit" >
        <apex:pageBlockSection title="Master Record Details" columns="1" >
            <apex:outputField value="{!MasterRecord.Name}" />
            <apex:outputField value="{!MasterRecord.Country__c}"  />
            <apex:outputField value="{!MasterRecord.Phone}"  />
        </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:pageBlock >
        <apex:pageBlockSection title="Displaying Child Records" columns="1">       
                <apex:tabPanel id="tbpanel1"> 
                    <apex:tab label="Contact">                    
                    <apex:outputPanel id="conPanel">
                    <apex:pageBlockTable value="{!ChildRecords}" var="con">
                            <apex:column value="{!con.FirstName}" />
                            <apex:column value="{!con.LastName}" />
                            <apex:column value="{!con.Phone}" />
                     </apex:pageBlockTable>
                     </apex:outputPanel>
                     </apex:tab>
                     <apex:tab label="Opportunity" id="oppTab">                 
                        <apex:outputPanel id="oppPanel">
                        <apex:pageBlockTable value="{!oppChildRecords}" var="opp" id="opps" >
                            <apex:column value="{!opp.Name}" />
                            <apex:column value="{!opp.Amount}" />
                            <apex:column value="{!opp.OrderNumber__c}" />
                        </apex:pageBlockTable>
                        </apex:outputPanel>
                     </apex:tab>
                 </apex:tabPanel>
            
            </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
Controller:

public with sharing class ApexController {

    public String MasterRecordId        {get; set;}
    public List<contact> ChildRecords  {get; set;}
    public account MasterRecord       {get; set;}
    public List<opportunity> oppChildRecords {get; set;}
    
    public ApexController()
    {
        MasterRecordId = ApexPages.currentPage().getParameters().get('id');
        
        if(!String.isBlank(MasterRecordId)){
           
            MasterRecord =[SELECT Name,Country__c,Phone FROM account WHERE Id = :MasterRecordId ];
            
           ChildRecords =[SELECT FirstName,LastName,Phone FROM contact WHERE accountId = :MasterRecordId];
            oppChildRecords =[SELECT Name,Amount,OrderNumber__c FROM opportunity WHERE accountId = :MasterRecordId];
        }
    }
}