Toggle Side Panel

  • Home
  • Articles
    • All Articles
    • Blogs
    • Videos
    • Infographics
  • Consultants
    • Salesforce Product Expertise
      • Top Salesforce ConsultantsTop Salesforce Consultants
      • Marketing Cloud ConsultantsMarketing Cloud Consultants
      • Service Cloud ConsultantsService Cloud Consultants
      • Experience Cloud ConsultantsExperience Cloud Consultants
      • Analytics Cloud ConsultantsAnalytics Cloud Consultants
    • Salesforce Industry Expertise
      • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
      • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
      • Health Cloud ConsultantsHealth Cloud Consultants
      • Commerce Cloud ConsultantsCommerce Cloud Consultants
      • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
    • Salesforce Experts by Location
      • USATop Salesforce Consultants in USA
      • IndiaTop Salesforce Consultants in India
      • AustraliaTop Salesforce Consultants in Australia
      • United KingdomTop Salesforce Consultants in UK
      • CanadaTop Salesforce Consultants in Canada
  • Webinars
  • Marketplace
  • Advertise With Us
  • Contact Us
  • Discussions
More options
    Sign in Sign up
    • Home
    • Articles
      • All Articles
      • Blogs
      • Videos
      • Infographics
    • Consultants
      • Salesforce Product Expertise
        • Top Salesforce ConsultantsTop Salesforce Consultants
        • Marketing Cloud ConsultantsMarketing Cloud Consultants
        • Service Cloud ConsultantsService Cloud Consultants
        • Experience Cloud ConsultantsExperience Cloud Consultants
        • Analytics Cloud ConsultantsAnalytics Cloud Consultants
      • Salesforce Industry Expertise
        • Non-Profit Cloud ConsultantsNon-Profit Cloud Consultants
        • Financial Service Cloud ConsultantsFinancial Service Cloud Consultants
        • Health Cloud ConsultantsHealth Cloud Consultants
        • Commerce Cloud ConsultantsCommerce Cloud Consultants
        • Manufacturing Cloud ConsultantsManufacturing Cloud Consultants
      • Salesforce Experts by Location
        • USATop Salesforce Consultants in USA
        • IndiaTop Salesforce Consultants in India
        • AustraliaTop Salesforce Consultants in Australia
        • United KingdomTop Salesforce Consultants in UK
        • CanadaTop Salesforce Consultants in Canada
    • Webinars
    • Marketplace
    • Advertise With Us
    • Contact Us
    • Discussions
    Close search

    Activity › Forums › Salesforce® Discussions › How to show related contacts under account in a Salesforce Visualforce page?

    Tagged: Account Detail, Contact Record, Dynamic Visualforce, Salesforce Visualforce Page, Visualforce Component

    • Salesforce® Discussions

      How to show related contacts under account in a Salesforce Visualforce page?

      Posted by Radhakrishna on August 21, 2017 at 4:03 AM

      I'm displaying all accounts in a visual force page where each row is having a first column as a '+'(expands). On clicking of symbol i wants to show related contacts under the same account.When I click on symbol account columns should be displayed in single row only and contacts should come below.

      Shubham replied 8 years, 7 months ago 3 Members · 2 Replies
      • Account Detail
      • Contact Record
      • Dynamic Visualforce
      • Salesforce Visualforce Page
      • Visualforce Component
    • 2 Replies
    • Neha

      Member
      August 21, 2017 at 12:22 PM

      Hello Radhakrishna,

      Please go through my earlier post at: VISIT HERE

      Hope it will help you.

      • This reply was modified 8 years, 7 months ago by  Neha.
    • Shubham

      Member
      August 21, 2017 at 1:00 PM

      Hello RadhaKrishna

      Please Try below Code

      Controller -

      public class actocons
      {
      public list<account> acct{set;get;}
      public actocons()
      {
      acct=[select id,name,(select id,lastname from contacts)from account limit 5];
      }
      }

      VisualForce Page -

      <apex:page controller="actocons" tabStyle="Account">
      <apex:pageBlock >
      <apex:repeat value="{!acct}" var="a">
      <apex:pageBlockSection id="section1" title="{!a.name}" onclick="document.getElementById('{!$Component.section1}').childNodes[0].childNodes[0].click();">
      <script>twistSection(document.getElementById("{!$Component.section1}").childNodes[0].childNodes[0]);document.getElementById("{!$Component.section1}").childNodes[0].style.cssText = "cursor:pointer;" </script>
      <apex:outputField value="{!a.Name}"/>
      <apex:pageBlockTable value="{!a.Contacts}" var="c" id="j1">
      <apex:column value="{!c.id}" />
      <apex:column value="{!c.lastname}"/>
      </apex:pageBlockTable>
      </apex:pageBlockSection>
      </apex:repeat>
      </apex:pageBlock>
      <script>
      twistSection = (function() {
      var cached_function = twistSection;

      return function(twisty, sectionId) {
      cached_function.apply(this, arguments); // use .apply() to call the original twistSection function provided by Salesforce
      if (event.stopPropagation) {
      event.stopPropagation();
      } else {
      event.cancelBubble = true;
      }
      };
      }());

      </script>
      </apex:page>

    Log In to reply.

    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me
    • Public
    • All Members
    • My Connections
    • Only Me

    application solution

    Popular Salesforce Blogs

    Navigating ERP Solutions: Custom Systems, Well-Known Providers, and Block-Based Approaches

    Blog in Others

    Enterprise resource planning (ERP) software is used by companies to manage routine business operations like accounting, order and project management, risk management, compliance, and supply…

    Benefits, Block-Based Approach, budget, Clear Vision, Companies
    Twistellar Jun 27, 2023
    1,382  Views

    Unleashing Collective Intelligence: How Salesforce Communities Empower Ideas Management

    Blog in Others

    Organizations are realizing the immense value of collective intelligence in driving innovation and staying ahead of the competition. Collective intelligence refers to the collective knowledge,…

    Benefits, Branded, branding, Breakthrough Innovations, Collaboration
    Jashandeep Jun 22, 2023
    2,421  Views
    What are Aura components in Salesforce?

    What are Aura Components in Salesforce? | The Ultimate Guide

    Blog in Others

    The Lightning Component framework may be a UI framework for developing web apps for mobile and desktop devices. It’s a contemporary framework for building single-page…

    Application, AURA, Aura Attribute, Aura Component, Aura Component Bundle
    Rupesh Pandey Mar 28, 2023
    2,419  Views

    Popular Salesforce Videos

    Understanding Leads, Accounts, Contact, Opportunities, Products, Pricebooks objects in Sales Cloud

    Understanding Leads, Accounts, Contact, Opportunities, Products, Pricebooks objects in Sales Cloud

    Video in Salesforce Cloud Platform

    In this video, I have explained how Salesforce SalesCloud can boost your companies productivity. Some Important object of Sales Cloud :  1. Campaign 2. Lead…

    Salesforce Sales Cloud, Salesforce Field Objects, Sales Cloud Consultant, Salesforce Customer Community, Salesforce CRM
    Jogender Dec 3, 2018
    5,094  Views
    What is the Difference Between Object and Database in Salesforce?

    What is the Difference Between Object and Database in Salesforce?

    Video in Salesforce Admin

    Salesforce Object: Salesforce Object are database table which give permission to store data that is specific to organization. Salesforce Database: The organized collection of object…

    Salesforce Training, Salesforce Online Training, Apex Class, Salesforce Database, Salesforce Adminstrator
    CRS Apr 18, 2022
    1,862  Views
    What are Permission Sets (Object Level Security) in Salesforce?

    What are Permission Sets (Object Level Security) in Salesforce?

    Video in Salesforce Security, Salesforce Training

    In this video, Shrey is not only teaching but also demonstrating Permission Sets used in Salesforce Object Level Security. You will be learning: What are…

    Salesforce Training, Salesforce Tutorial, Salesforce Administrator, salesforce, Salesforce Video
    Abhishek Dec 11, 2020
    2,481  Views
    Footer Forcetalks logo

    support@forcetalks.com

    • twitterx

    Quick Links

    Advertise with Us

    Salesforce® Articles

    Dreamforce 2023

    Top Salesforce® Bloggers 2023

    Top Salesforce Consultants

    Get Listed

    Company

    Contact Us

    About Us

    Privacy Policy

    Terms & Conditions

    InsightHub

    Salesforce Blogs

    Salesforce Videos

    Salesforce Groups

    Salesforce Jobs

    © 2026 - Forcetalks ● All Rights Reserved

    Salesforce® is a trademark of Salesforce® Inc. No claim is made to the exclusive right to use “Salesforce”. Any services offered within the Forcetalks website/app are not sponsored or endorsed by Salesforce®.

    Try AuditMyCRM - It is a Salesforce CRM Audit tool which comprehensively scans your Salesforce org and gives you the list of errors or warnings you need to take care of.
    We use cookies to enhance your browsing experience. Please see our privacy policy if you'd like more information on our use of cookies.