I currently have an ultragrid that is bound to a DataSet containing a number of DataTables.
I update this grid by merging an updated DataSet with my current DataSet. This seems to work OK, however the merge takes 3 seconds, during which time the ultragrid is unresponsive. Seeing as I'm updating the data every 10 seconds that means my grid is unusable for 30% of the time which is a bit of a problem for the user.
Is there a way to merge the DataSet without hanging the grid?
Charlie
Try grid.BeginUpdate() and grid.SuspendRowSynchronization()
Don't forget to reenable them in finally{} clause
Dacos,
Thanks for your post, I am already using BeginUpdate and SuspendRowSynchronization
Well after some investigation I came to the conclusion that the problem probably lies with the DataSet merge, not the grid.
Since the DataSet that I am merging is bound to the grid (which is on the GUI thread) the merge has to be performed on the GUI thread. If you try and do it asynchoronously on another thread you get a whole load of grid errors as rows get unexpectedly changed/inserted/deleted.
Now since the merge has to be run on the GUI thread, the GUI will freeze until the merge has completed.
Now if Microsoft made the DataSet merge a bit quicker then maybe I wouldn't get these sort of problems.
Alternatively if I could find a way of disconnecting the grid BindingSource completely whilst I do the merge then that would do the trick (SuspendBinding and ResumeBinding don't help me unfortunately)
Thanks for all your help
There's a good discussion of this at: http://forums.infragistics.com/forums/p/15832/57858.aspx#57858
As you can see, I am the author of the thread you mentioned ;)
Our application ended in calling BeginUpdate(), SuspendRowSynchronization(), grid.Enabled = false; ___ and we also make the grid invisible replacing it with a screenshot__.
This whole "there is no good solution, try to shoot out of all guns you have" works for us (we could not reproduce any thread issues and AFAIK have not had any bug reports from our user which could result from synchronisation problems). At least the client is not freezed during the operation, and the user can access other parts of our application.
There is no guarantee that this hack will work for you. Of course it would be a good idea to try to solve the issue with "normal" means.
dacos_sscherer001 said:grid invisible replacing it with a screenshot
I presuming this is a predetermined screen shot, right, not a "live" screenshot?
This is a "live" screenshot. If the control is not resized - the user doesn't actually see the difference (the grid is just "locked"). When resizing a gray background is visible. Acceptable for us (we didn't have much choice honestly saying :) )
Bitmap bitmap = new Bitmap(control.Width, control.Height);control.DrawToBitmap(bitmap, Rectangle.FromLTRB(0, 0, bitmap.Width, bitmap.Height));disabledGridPictureBox.Image = bitmap;disabledGridPictureBox.Dock = DockStyle.Fill;disabledGridPictureBox.SizeMode = PictureBoxSizeMode.Normal;disabledGridPictureBox.BringToFront();
Now THAT is clever, will have to have a look and investigate.