Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class wrapperclass {
- public List<account> acc {get;set;}
- public List<contact> con {get;set;}
- public account a {get;set;}
- public boolean b {get;set;}
- public list<wrapper> wrap=new List<wrapper>();
- public list<wrapper> getContacts(){
- String accid=ApexPages.currentPage().getParameters().get('id');
- a=[select id,name from account where id=:accid];
- con=[select id,name,email from contact where accountid=:accid];
- if(con.size()!=0)
- {
- b=true;
- }
- else
- {
- b=false;
- }
- for(Contact c:con)
- {
- wrap.add(new wrapper(c.id,c.name,c.email));
- }
- return wrap;
- }
- <apex:page controller="wrapperclass">
- <apex:pageBlock>
- <apex:pageBlockTable value="{!Contacts}" var="w" rendered="{!b}">
- <apex:column headerValue="Related Contacts"/>
- <apex:column headerValue="{!a.name}"/>
- <apex:column value="{!w.id}"/>
- <apex:column value="{!w.name}"/>
- <apex:column value="{!w.email}"/>
- </apex:pageBlockTable>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement