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
490
AfterColPosChanged event doesn't fire
posted

I am using the 2006 version of the UltraGrid.  Maybe this has changed in the current version, but when I change the hidden value of a column programmatically, the AfterColPosChanged event does not fire.  It does fire if I hide/show a column using the column chooser though.

In code I am setting "column.Hidden = true" for a column that is visible in the grid.  I would expect to see the AfterColPosChanged event fire and the "e.PosChanged" value equal to "PosChanged.HiddenStateChanged"

Do you know why this event does not fire when a change is made programmatically to the hidden property of a column?

Thanks!

Steve

Parents
  • 469350
    Suggested Answer
    Offline posted

    This is something of a gray area. Some events fire only in response to user action and some fire for both user action and changes made in code. The basic purpose of an event is to let you know that the user changed something. If you changed something in code, you don't need an event to tell you that you did it, because you already know.

    Of course, it's often convenient to have all the code that responds to a change in the same place.

    What I would do is just take the code you have in AfterColPosChanged out of the event and put it into a method. Then call that method from the event handler and from any other place in your code where you are changing the hidden state of a column.

Reply Children
No Data