Databound Label text displays old data upon save. Re-open record and data is correct?
Posted
by Mike Hestness
on Stack Overflow
See other posts from Stack Overflow
or by Mike Hestness
Published on 2010-06-07T17:07:07Z
Indexed on
2010/06/07
17:12 UTC
Read the original article
Hit count: 125
I have a windows forms application. I have a main form and I have a button on this form to set a "Qualified" date/time stamp. I have a Databound label control that I set the value when the user clicks the button. This date/time stamp is working as far as displaying but when you click the save button it either shows blank or the previous date/time. If you then then close the record and re-open it the new date/time value is displayed so the data is getting to the database it's just not persisting in the dataset as new data?? Not sure why the databinding isn't refreshing the value.
I have noticed this behavior even if I use a textbox, same thing if I do it programatically. If I manually type in a value it persists??
Here is the code I'm using in the click event of my button:
string result = string.Empty;
string jobOrderID = UnitOfWork.MasterDSBS.MJOBO[0].JC_IDNO.ToString();
string timeNow = DateTime.Now.ToString();
//Call Web service to make the update
RadServices.Service1 rsWeb = new RadServices.Service1();
result = rsWeb.SetQualifiedDate(timeNow, jobOrderID );
//Changed the qualified label text.
_btnQualify.Text = "Qualified";
rlQualifiedDate.Text = timeNow;
© Stack Overflow or respective owner