Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. public class wrapperclass {
  2.  
  3. public List<account> acc {get;set;}
  4. public List<contact> con {get;set;}
  5. public account a {get;set;}
  6. public boolean b {get;set;}
  7.  
  8.  
  9. public list<wrapper> wrap=new List<wrapper>();
  10.  
  11. public list<wrapper> getContacts(){
  12.  
  13. String accid=ApexPages.currentPage().getParameters().get('id');
  14. a=[select id,name from account where id=:accid];
  15. con=[select id,name,email from contact where accountid=:accid];
  16. if(con.size()!=0)
  17. {
  18. b=true;
  19. }
  20. else
  21. {
  22. b=false;
  23. }
  24. for(Contact c:con)
  25. {
  26. wrap.add(new wrapper(c.id,c.name,c.email));
  27. }
  28. return wrap;
  29. }
  30.  
  31. <apex:page controller="wrapperclass">
  32. <apex:pageBlock>
  33. <apex:pageBlockTable value="{!Contacts}" var="w" rendered="{!b}">
  34. <apex:column headerValue="Related Contacts"/>
  35. <apex:column headerValue="{!a.name}"/>
  36. <apex:column value="{!w.id}"/>
  37. <apex:column value="{!w.name}"/>
  38. <apex:column value="{!w.email}"/>
  39.  
  40. </apex:pageBlockTable>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement