Hi!
I have a loop that reorders all the columns of an ultragrid. Something like this:
foreach (var column in band.Columns) column.Header.VisiblePosition = positions[column.key];
After profiling my application I show that this code needs about 5 seconds to run, for about 15 columns. I tried using Suspend/ResumeLayout but it didn't help.
Is there anything that I can do?
Hello Dimitris
What version of Net Advantage are you using? I am assuming that the positions object in the code snippet is some collection of integers. How many columns does the grid have?
Yes, obviously it's a collection of integers, and as I'm saying above there are about 15 columns.
Also there are about 25 rows of data on the grid when this code runs.
I can't see any reason why this code would cause a performance problem. My guess is that this is a bug that was recently fixed. Do you have the latest service release? If not, you should get it and see if that helps.
How to get the latest service release - Infragistics Community
On a completely unrelated note, I'd be surprised if the code you have here works as you expect. You really can't set the VisiblePosition in the order of the columns, because setting the position of a later column could change the position of an earlier one.
A much better way to do this would be to simply use the grid's built-in save and load methods on the DisplayLayout.
If, for some reason, you cannot do that, then you need to set the VisiblePositions of the columns in order from 0 up in order for the code to work reliably.