Advertisement
Guest User

Untitled

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