Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3. tadbDataContext tadb = new tadbDataContext();
  4. Dictionary<string, string> hexColors = tadb.msp_silentAuctionColors.ToDictionary(t => t.colorDescription, t => t.colorValue);
  5.  
  6. tbTextColor.Text = hexColors["textColor"];
  7. tbAltColor.Text = hexColors["altColor"];
  8. tbBackgroundColor.Text = hexColors["backgroundColor"];
  9. }
  10.  
  11. using (tadbDataContext tadb = new tadbDataContext())
  12. {
  13. var textColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "textColor");
  14.  
  15. var altColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "altColor");
  16. var backgroundColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "backgroundColor");
  17.  
  18. textColor.colorValue = tbTextColor.Text;
  19. altColor.colorValue = tbAltColor.Text;
  20. backgroundColor.colorValue = tbBackgroundColor.Text;
  21.  
  22. tadb.SubmitChanges();
  23. }
  24.  
  25. protected void Page_Load(object sender, EventArgs e)
  26. {
  27. if(!Page.IsPostBack)
  28. {
  29. tadbDataContext tadb = new tadbDataContext();
  30. Dictionary<string, string> hexColors = tadb.msp_silentAuctionColors.ToDictionary(t => t.colorDescription, t => t.colorValue);
  31.  
  32. tbTextColor.Text = hexColors["textColor"];
  33. tbAltColor.Text = hexColors["altColor"];
  34. tbBackgroundColor.Text = hexColors["backgroundColor"];
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement