Guest User

Untitled

a guest
May 20th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. Item
  2. ----------------
  3. Joe Bloggs
  4. George Forman
  5. Peter Pan
  6.  
  7. NAME EMAIL
  8. ------------------------------------------------------
  9. Joe Bloggs joe@bloggs.com
  10. George Forman george@formangrills.co
  11. Peter Pan me@neverland.com
  12.  
  13. // Where List is instantiated
  14. List<List<string>> list2d = new List<List<string>>
  15.  
  16. ...
  17.  
  18. // Where DataGrid instance is given the list
  19. dg.DataSource = list2d;
  20. dg.DataBind();
  21.  
  22. ...
  23.  
  24.  
  25. // In another method, where all people add their names and emails, then are added
  26. // to the two-dimensional list
  27. foreach (People p in ppl.results) {
  28. list.Add(results.name);
  29. list.Add(results.email);
  30. list2d.Add(list);
  31. }
  32.  
  33. Capacity Count
  34. ----------------
  35. 16 16
  36. 16 16
  37. 16 16
  38. ... ...
  39.  
  40. public class Person {
  41. public string Name {get; set;}
  42. public string Email {get; set;}
  43. }
  44.  
  45. var people = new List<Person>();
  46.  
  47. foreach (People p in ppl.results) {
  48. list.Add(results.name);
  49. list.Add(results.email);
  50. list2d.Add(list);
  51. }
  52.  
  53. foreach (People p in ppl.results) {
  54. var list = new List<string>();
  55. list.Add(p.name);
  56. list.Add(p.email);
  57. list2d.Add(list);
  58. }
Add Comment
Please, Sign In to add comment