I have a major problem and unfortunately I just cannot find any answers. Please help. I am at my wit's end.
I have a custom module that does something very simple: it edits the values of a single record from a database table via Linq to Sql. I have created an edit form and I can add a new entity just fine; all the values of the fields on the page are grabbed, stuffed into the entity and saved correctly. The method for adding looks like this:
protected void Add_Click(object sender, EventArgs e)
{
MyDataContext db = new MyDataContext ();
var doc = new MyDocument();
doc.ModuleId = ModuleId;
doc.Header = _header.Text;
doc.URL = _url.Text;
db.MyDataContext .InsertOnSubmit(doc);
db.SubmitChanges();
db.Dispose();
Response.Redirect(Globals.NavigateURL(), true);
}
This works for insertion just fine.
What does not work is updating any of the values. The update method looks basically the same, except I query for the entity first. Then I try and copy the values from the fields on the page. Only the fields don't contain the new data! I decided to use Response.Write to actually write out the values of the text fields on the page, and they are not printing out the newly edited values. The old values are getting printed out. Which tells me that for some reason the new values are not getting back to me. Now, it's been a while since I did anything in asp.net, so please, someone help me out here. This shouldn't be this hard.