problem with linq to sql update using asp.net textboxes

I have a textbox and a button. On page load I select one column from one row and put its value in the textbox. I have a button click method that updates the same column/row with the value in the textbox.The problem i'm having is that when I clear the text in the text box, type in new data and hit submit the new text value is not being saved, it uses the old one. I put a breakpoint at the end of my button click method and it appears that asp.net is sending the old value of the textbox rather than the new one I put in. I'm totally stumped.
  • This problem persists even if I have viewstate false on the textbox.
  • Both of my LINQ queries are wrapped in a using statement.
Any Ideas?Edit: Here is the full code:\[code\] protected void Page_Load(object sender, EventArgs e) { using (StoreDataContext da = new StoreDataContext()) { var detail = from a in da.Brands where a.BrandID == 5 select new { brand = a, }; foreach (var d in detail) { txtEditDescription.Text = d.brand.Description; } } } protected void Button1_Click(object sender, EventArgs e) { using (StoreDataContext dk = new StoreDataContext()) { Brand n = dk.Brands.Single(p => p.BrandID == 5); n.Description = txtEditDescription.Text; dk.SubmitChanges(); } }\[/code\]
 
Back
Top