Hi,
My actual issue is exactly the same as the issue in this post: http://forums.infragistics.com/forums/p/33155/181098.aspx#181098. The only difference is that in the other forum post the user was binding to a calculated column being updated by a SQL Server call. That is NOT the case here ...
To recap quickly, I have an application that has multiple grids and win forms. A certain number of them bind to the same data table underneath. When I go to update a field in one of the win forms, I expect that same field in the grids to be updated as well since they are bound to the same data column. What I instead have to do is to click on another record in one of the grids and then click back to the record that was updated to see the change. I'm actually expecting that as soon as I tab off the field in the win form the same field in the grids is updated.
In the other forum post it was mentioned that this could be caused by the binding not sending a notification to the other controls to refresh. What would cause this to happen? What would be a fix that could be applied to correct this?
To answer some of the questions Mike had in the other forum post: The typical example in my application is an Order Qty field. If the user changes the value in the win form in the UltraNumericEditor control that is bound to the order quantity data column, the order quantity in the grid columns (also bound to the order quantity data column) do not update when the user tabs out of the UltraNumericEditor. The property I'm binding to for this field is the "Text" property.
Any help solving this issue would be greatly appreciated.
Thank you,
Steve
Hi Mike,
Steve (thread author) and I are co-workers . We created a sample project to illustrate the problem Steve wrote about in this thread.
Notice in the image how field values are different. I changed the ID field at bottom and tabbed out. But the Grid continue to show the old value.
However, the very first time when I update the ID form field and tab out, it updates the Grid as expected. After that time, the Grid no longer refreshes on tabbing out out of ID form field . I have to either hover over the Grid row I just updated or click on another row to make it refresh.
You can see this in a very simple example I attaching. We would appreciate if you could try it and let us know what is causing this behavior.
Thank you very much!
PS; Since we are using an older version of Infragistics, I have built the solution with "copy local" to help you build quickly.
Thank you Mike. We will be taking a look into the BindingContext to see if that is the issue and will use the work around if necessary. Thanks again for your help and guidance.
Hi Steve,
I never had any doubt that the underlying data source is getting updated. You mentioned in your original post that mousing over the cell causes it to update. This is not surprising, since the cell goes and gets the value when it needs to paint.
So the problem here is that when you make the change on your form, your data source is not sending a notification to the grid that the change has been made and the grid does not know that it needs to refresh at that point.
This could be because of different BindingContexts, as I explained in my previous post.
This can also occur if your data source doesn't support IBindingList, but if you are using a DataSet, then that is clearly not the problem.
If you want to try to work around this, you can do so pretty easily by calling grid.Rows.Refresh(RefreshDisplay) any time a change occurs on your form.
Hi Mike ... The data source I'm using is a dataset made up of temp-tables from a database. My forms and grids are bound to the same data source... In doing some more testing, it looks like the binding is working correctly as the underlying data tables get updated immediately when I change a value in the form or in the grid, and eventually the correct data appears in all the appropriate places ... However, I noticed that when I update a field on the form and then move my cursor so that it hovers over the same field in the grid, the grid refreshes and displays the updated value. It seems like there is a "lazy" refresh occurring for the grid. Is this a grid setting that you know of? ... Also, another curious thing I noticed is that the very first time I make a change in the form after bringing the application up, all the grids refresh and display the updated values correctly. But every subsequent change no longer appears immediately in the grids and the only way to get the changes to show is to hover over the field in the grid or click onto another record and then click back to the one I was editing. ... Any additional help you can give me to solve this mystery would be greatly appreciated.
Thanks!
What kind of data source are you using here?
Let's take a simple example.. suppose I have a single grid on a form bound to some data source. When I do something (like click a button), I show a form with fields bound to the same data with individual controls like TextBoxes.
To make this work, the form I show would have to be bound to the same DataSource that the grid is using. And that DataSource has to be a robust data source that implement IBindingList. If it's just an IList, it won't work, because it will not notify the bound controls that things have changed.
Also, I'm pretty sure this won't work unless both the grid and the controls on the form have the same BindingContext. So you may need to set the BindingContext on the edit form to the same BindingContext that the grid is using. In fact, I'm not sure if just setting the BindingContext of the form will work. I think it will, because I'm pretty sure the controls on the form will get their BindingContext from their container... but you might have to set it on each control if the controls ar not directly on the form.