Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
Change column Index programatically
posted

Hi,

I have a grid with some columns on it. I want the users to be able to move the column order, and the order they set to be saved on a file so after the user logs in again, the same order is on the screen.

I managed to get the order of the columns and save it to a file (by handling the ColumnMove event), but I can not seem to be able to restore it  after that because the Index property of the column is Read Only.

Any suggestion on how to restore the column order?

Thanks!

Parents
No Data
Reply
  • 45049
    Verified Answer
    posted

    Use the Move() method of the UltraGridColumn object, passing in the index where you want it to appear.

    I suggest you start with the column that you want to have at index 0, then 1, then 2, and so on.  Doing this will ensure that the columns remain in the same order, since the Index properties of other columns in the collection are adjusted to make room to put the column you're moving into the desired location.

Children
No Data