Advertisement
Guest User

Untitled

a guest
Jul 6th, 2015
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public List<Account> acclist{get;set;}
  2. public List<Contact> conlist{get;set;}
  3. public List<MyWrapper> wap{get;set;}
  4.  
  5. public WrapperAccountCtrl()
  6. {
  7. acclist=[Select id,name from Account];
  8.  
  9. conlist=[Select id,name,AccountID from contact where AccountID IN:acclist];
  10.  
  11. system.debug('Size----'+conlist.size());
  12.  
  13. wap=new List<MyWrapper>();
  14.  
  15. for(integer i=0;i<acclist.size();i++)
  16. {
  17. wap.add(new MyWrapper(conlist,acclist[i]));
  18.  
  19. }
  20.  
  21. }
  22.  
  23.  
  24.  
  25. public class MyWrapper
  26. {
  27.  
  28. public Account accn{get;set;}
  29.  
  30. public List<Contact>conrec{get;set;}
  31.  
  32. public MyWrapper(List<Contact> con,Account acc)
  33. {
  34. accn=acc;
  35. conrec=con;
  36.  
  37. }
  38.  
  39.  
  40. }
  41.  
  42. <apex:pageBlock >
  43. <apex:pageBlockTable value="{!conlist}" var="c">
  44.  
  45. <apex:column value="{!c.account.Name}"/>
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52. </apex:pageBlockTable>
  53.  
  54.  
  55.  
  56. </apex:pageBlock>
  57.  
  58.  
  59.  
  60.  
  61. </apex:form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement