You need to sign in to do that
Don't have an account?
suresh dupada
How to display related contacts in Another table using Pagereference
I wrote a code for the following output:
<apex:page standardController="Account" recordSetVar="RecordsSet">
<apex:form >
<apex:pageBlock >
<apex:pageblocksection >
<apex:pageblockTable value="{!RecordsSet}" var="rec" id="TableOne">
<apex:column ><apex:facet name="header"></apex:facet>
<apex:commandLink value="{!rec.name}"/>
</apex:column>
</apex:pageblockTable>
</apex:pageblocksection>
</apex:pageBlock>
</apex:form>
</apex:page>
But, Here i need when i click on any of the records then i want to display related contacts for that account in the TableTwo in the same page using PageReference or any other methods.............
I Would appriciate any king of replay..................
<apex:page standardController="Account" recordSetVar="RecordsSet">
<apex:form >
<apex:pageBlock >
<apex:pageblocksection >
<apex:pageblockTable value="{!RecordsSet}" var="rec" id="TableOne">
<apex:column ><apex:facet name="header"></apex:facet>
<apex:commandLink value="{!rec.name}"/>
</apex:column>
</apex:pageblockTable>
</apex:pageblocksection>
</apex:pageBlock>
</apex:form>
</apex:page>
But, Here i need when i click on any of the records then i want to display related contacts for that account in the TableTwo in the same page using PageReference or any other methods.............
I Would appriciate any king of replay..................
1. You need to use custom controller and have a List<Contact> variable in controller
2. Fetch List of Accounts in constructor of controller and you can fetch all Contacts as inner query in Accout list like below: When you click on any Account from List then you just need to reset List<Contact> variable you created with Id of Account you selected on UI. So you will use <apex:param> inside <apex:commandlink> tag which will set a Id variable in controller in controller and then method is called which re-renders the List of Contact variable.
You can also use it like below:
Create a Page block with id "contactlist" which has table iterating over "lContacts" and will refresh based on click of commandlink.
PS: if this answers your question then hit Like and mark it as solution!