Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public class ComboData
  2. {
  3.  
  4. public int Id { get; set;}
  5.  
  6. public string Value { get; set;}
  7.  
  8. public string description { get; set;}
  9.  
  10. }
  11.  
  12. List<ComboData> ListData = new List<ComboData>();
  13. ListData.Add(new ComboData { Id = "1", Value = "One" });
  14. ListData.Add(new ComboData { Id = "2", Value = "Two" });
  15. ListData.Add(new ComboData { Id = "3", Value = "Three" });
  16. ListData.Add(new ComboData { Id = "4", Value = "Four" });
  17. ListData.Add(new ComboData { Id = "5", Value = "Five" });
  18.  
  19. cbotest.ItemsSource = ListData;
  20. cbotest.DisplayMemberPath = "Value";
  21. cbotest.SelectedValuePath = "Id";
  22.  
  23. cbotest.SelectedValue = "2";
  24.  
  25. public class DAL
  26. {
  27. Dbcontext db = new Dbcontext();
  28.  
  29. public List<ComboData> GetAll()
  30. {
  31. var sp = db.ComboDatas.ToList();
  32. return sp;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement