When my page loads, it queries the database for some values โโand populates them with text fields:
protected void Page_Load(object sender, EventArgs e) { tadbDataContext tadb = new tadbDataContext(); Dictionary<string, string> hexColors = tadb.msp_silentAuctionColors.ToDictionary(t => t.colorDescription, t => t.colorValue); tbTextColor.Text = hexColors["textColor"]; tbAltColor.Text = hexColors["altColor"]; tbBackgroundColor.Text = hexColors["backgroundColor"]; }
Then I change the value and try to resubmit it to the database by clicking a button that does the following:
using (tadbDataContext tadb = new tadbDataContext()) { var textColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "textColor"); var altColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "altColor"); var backgroundColor = tadb.msp_silentAuctionColors.Single(x => x.colorDescription == "backgroundColor"); textColor.colorValue = tbTextColor.Text; altColor.colorValue = tbAltColor.Text; backgroundColor.colorValue = tbBackgroundColor.Text; tadb.SubmitChanges(); }
The value sent back is the original (not changed) value. If I comment out the lines filling the text fields at boot time, it works fine.
source share