Every now and then I update about 3 rows. The content of the first row is not refreshed until I hover over with the mouse pointer.
I use the same update method for all rows.
This happens mostly when row 1-3 is updated very fast after each other. Any ideas?
Hi,
What version of the grid are you using?
What kind of DataSource are you binding the grid to?
If your DataSource is an IList (and not an IBindingList), then the grid will not be notified of changed in the data source. In such a case, you can manually tell the grid that something has changed by calling grid.Rows.Refresh(ReloadData).
Also, if you know you are going to be updating more than one row in the grid's datasource at once, it's sometimes a good idea to tell the grid not to paint or update from the data source during the process, but instead to do one big update after all the changes have completed. This is better for performance and efficiency and can also sometimes alleviate problems like the you you describe.
The way to do it looks like this:
this.ultraGrid1.BeginUpdate(); this.ultraGrid1.SuspendRowSynchronization(); try { // Update a bunch of rows in the grid's DataSource here. } finally { this.ultraGrid1.ResumeRowSynchronization(); this.ultraGrid1.EndUpdate(); }
Thanks for your reply. I am using a normal Dataset with normal Datatable as source. How does that affect this?
The updating is event driven so I do not know when next update will come (even though they come often). Currently I am using Begin and EndUpdate inside a lock to prevent threading problems.
m97_rek said:Thanks for your reply. I am using a normal Dataset with normal Datatable as source. How does that affect this?
That's good, it means your data source will notify the grid of changes.
m97_rek said:Currently I am using Begin and EndUpdate inside a lock to prevent threading problems.
My guess is you are having threading problems. What exactly are you doing with threading? If you are binding the grid to a DataSource that is on another thread, you will have all sorts of problems. If you modify or even try to read data from your DataSource on another thread, it will cause problems.
A lock will not help because you are not in control of the communication between the grid, the BindingManager, and the DataSource. There is all sorts of communication between these objects that happens behind the scenes and you cannot intercept it.