+ Start a Discussion
Sugandha Kumari 11Sugandha Kumari 11 

On click ,how to render pageblocks in a VF page

How on clicking an Account displayed on VF page ,I can render 2 pageblocks(i.e Contacts and Opportunity)
SandhyaSandhya (Salesforce Developers) 
Hi Sugandha Kumari,

You need to use action support for this.

Please refer below link.

https://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_actionSupport.htm
 
Below is sample code.
<apex:page controller="accext">
   <apex:form >
       <apex:pageblock title="Account with related list">
           <apex:pageBlockTable value="{!accinfor}" var="acc">
               <apex:column >
                   <apex:outputPanel >
                   <apex:actionsupport event="onmouseover" rerender="nani">
                       <apex:param name="cid" value="{!acc.id}"/>
                       {!acc.name}
                   </apex:actionsupport>
                   </apex:outputPanel>
               </apex:column>
           </apex:pageBlockTable>           
       </apex:pageblock>
 
  <apex:outputPanel id="nani">
         <apex:pageBlock >
          <apex:pageblockTable value="{!relatedcontact}" var="rlc">
              <apex:column value="{!rlc.name}"/>
         
          </apex:pageblockTable>
          </apex:pageBlock>
         
         
 
 
  </apex:outputPanel>
  </apex:form>
</apex:page>

Please refer below links for more information.

https://developer.salesforce.com/forums/?id=906F000000098j6IAA
 
Hope this helps you!

Please mark it as Best Answer if my reply was helpful. It will make it available for other as the proper solution. 
 
Thanks and Regards
Sandhya