views:

22

answers:

1

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;
A: 

Have you tried refreshing the control.

RandomNoob
Yes, calling refresh then saving the form has the same affect. The old value is displayed. Close the record and re-open and the new value is displayed in the label.
Mike Hestness
_btnQualify.Text = "Qualified"; rlQualifiedDate.Text = timeNow; rlQualifiedDate.Refresh();
Mike Hestness
Must be the invocation of your data bind, when you persist the change, do you immediately call the code that binds the data?
RandomNoob
I had to use a web service to actually update the value since my code wouldn't work otherwise. The controls are bound from the designer so i'm not sure where the DataBind is getting called. This is a legacy app I inherited and I'm used to working mostly in asp.net... There is a lot of abstraction of classes and inheritance in this code.
Mike Hestness
Can you step through the code and see when the data is initially being bound, i.e. if you find the initial point where the data is bound, you need to just recall that method/code post save
RandomNoob
Because the designer was used to bind the controls it looks like it's happening in the InitializeComponent() method. I tried calling that after making my changes but it just changes my data to "System.Data.DataRowView" weird.
Mike Hestness