You need to sign in to do that
Don't have an account?
Nagaraju Mogili 31
need to show the Account and its related contacts in single vf page using pageblock table
public class PageBlockTable_cntrlr {
Public List<Account> acclist {get;set;}
public PageBlockTable_cntrlr(){
acclist = new List<Account>([select Id,Name,(select firstname,LastName from contacts) from Account]);
}
}
======
<apex:page controller="PageBlockTable_cntrlr" >
<apex:form >
<apex:pageBlock title="List OF Accounts">
<apex:pageBlockTable value="{!acclist}" var="x">
<apex:column value="{!x.Id}"/>
<apex:column value="{!x.Name}"/><tr>
<apex:pageBlockTable value="{!x.contacts}" var="y">
<apex:column value="{!y.firstname}"/>
<apex:column value="{!y.LastName}"/>
</apex:pageBlockTable> </tr>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============
with this I can able to display the single Account details only, how can i display the contact details beside of Account object
Public List<Account> acclist {get;set;}
public PageBlockTable_cntrlr(){
acclist = new List<Account>([select Id,Name,(select firstname,LastName from contacts) from Account]);
}
}
======
<apex:page controller="PageBlockTable_cntrlr" >
<apex:form >
<apex:pageBlock title="List OF Accounts">
<apex:pageBlockTable value="{!acclist}" var="x">
<apex:column value="{!x.Id}"/>
<apex:column value="{!x.Name}"/><tr>
<apex:pageBlockTable value="{!x.contacts}" var="y">
<apex:column value="{!y.firstname}"/>
<apex:column value="{!y.LastName}"/>
</apex:pageBlockTable> </tr>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
=============
with this I can able to display the single Account details only, how can i display the contact details beside of Account object
Regards,
Avishek nanda
Mark this as your best answer if it resolves your query.
try this once may be it should helps
<apex:page controller="PageBlockTable_cntrlr" >
<apex:form >
<apex:pageBlock title="List OF Accounts">
<apex:pageBlockTable value="{!acclist}" var="x">
<apex:column value="{!x.Id}"/>
<apex:column value="{!x.Name}"/>
<apex:column headerValue="FirstName">
<apex:repeat value="{!x.Contacts}" var="string" >
<apex:outputText value="{!string.FirstName}"/><br/>
</apex:repeat>
</apex:column>
<apex:column headerValue="LastName">
<apex:repeat value="{!x.Contacts}" var="string" >
<apex:outputText value="{!string.LastName}"/><br/>
</apex:repeat>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>