+ Start a Discussion
sonam gupthasonam guptha 

In a Single Visualforce with different tabs and different values

HI,

-Iam struggling with problem please provide me some solution.
-how can we create three tabs in a single visual force page and that 3 tabs need to show different values on the page on a Account Search?

for example:

iam searching Account ‘Wipro’ on that particular visual force page,as result i have to show the different values on the three tabs?
search ————> Account ‘Wipro’

Result should be like :—

tab 1          tab 2        tab3
  |             |             |
  |             |             |
  |             |             |
Avg         sum        startdate
of           of           of 
Account      Account     Account   
Thanks In Advance!
Maharajan CMaharajan C
Hi Sonam,

You have to use the <apex:tab > tags in the VF page.

Please execute the below example code then you can easily understand.

<apex:page standardController="Account">
<apex:tabPanel switchType="client">
<apex:tab label="Account Details" name="AccountRaj"> 
<apex:detail relatedList="false"/>
</apex:tab>
<apex:tab label="Contact Details" name="AccountRaj1"> 
<apex:repeat value="{!Account.contacts}" var="contact">
        <apex:pageBlock title="{!contact.name}">
          <apex:pageBlockSection >
            <apex:pageBlockSectionItem >
              <apex:outputLabel value="Name"/>
              <apex:outputLink value="{!URLFOR($Action.Contact.View, contact.id)}">
                <apex:outputField value="{!contact.name}" />
              </apex:outputLink>
            </apex:pageBlockSectionItem>
            <apex:pageBlockSectionItem />
            <apex:outputField value="{!contact.Email}" />
            <apex:outputField value="{!contact.HasOptedOutOfEmail}" />
            <apex:outputField value="{!Contact.Phone}" />
            <apex:outputField value="{!Contact.Birthdate}" />
            <apex:outputField value="{!contact.Title}" />
            <apex:outputField value="{!contact.HasOptedOutOfFax}" />
          </apex:pageBlockSection>
        </apex:pageBlock>
           <apex:relatedList subject="{!contact}" list="OpenActivities" />
        <br/>
      </apex:repeat></apex:tab>
<apex:tab label="Opportunity Details" name="AccountRaj2"> 
<apex:pageBlock >
    <apex:pageBlockTable value="{!Account.Opportunities}" var="cam">
      <apex:column value="{!cam.Name}"/>
      <apex:column value="{!cam.Amount}"/>
      <apex:column value="{!cam.StageName}"/>
      <apex:column style="color: {!IF(AND(NOT(ISNULL(cam.Amount)), cam.StageName='Closed Won'), "lawngreen", "red")}" value="{!cam.CloseDate}"/>
    </apex:pageBlockTable>
  </apex:pageBlock>
</apex:tab>

</apex:tabPanel>  
</apex:page>

Can you please Let me know if it works or not!!!

If it helps don't forget to mark this as a best answer!!!

Thanks,
​Raj
sonam gupthasonam guptha
hello,

Thanks for the reply,here iam using this soql query to pull the data from custom object and wants display the same data on VF page but iam getting the view state exceed error can you please have a look?
 
select as_of_date__c, salesforceid__c, name__c, sum(arr_usd__c) from history__c where status__c <> 'Cancelled' group by as_of_date__c, salesforceid__c, name__c order by as_of_date__c, salesforceid__c desc
ERROR 
Maximum view state size limit (135KB) exceeded. Actual view state size for this page was 198.938KB
Class 
 
public with sharing class sampleARR {
  public List<history__c> ARR{get;set;}      
    public sampleARR()
    {
        ARR = [select as_of_date__c, salesforceid__c, name__c, sum(arr_usd__c) from history__c where status__c <> 'Cancelled' group by as_of_date__c, salesforceid__c, name__c order by as_of_date__c, salesforceid__c desc];
    }
}

VF Page :--

Please provide me exact tags iam a bit confused what to use

Thanks in Advance!