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
920
Selected, Active and AfterRowActivate
posted

Hello. I'm using a grid where I only need to manage one selected row at the time. So based in some reading I disabled row selecting (or set it as single row, I don't remember) and use ActiveRow.

Using the active row when I needed to know if it changed I used the AfterRowActivate event. This worked great until I realize that it only fires one some row is activated and not when the ActiveRow (property of the grid) change. The difference (pretty small) is that when a row is desactivated but no other is activated, the event is not fired.

I need to run some code when the ActiveRow changes (no matter if the new value is a row or null). How can I do? Is changing to selected row my only way?

Thanks,

Diego

  • 469350
    Verified Answer
    Offline posted

    Hi Diego,

    So I guess the issue is that you are trying to detect when the ActiveRow is null? This should never happen, unless there are no rows in the grid at all. So I would think that using AfterRowActivate would be fine, as long as you also trap AfterRowsDeleted and check for grid.Rows.Count == 0.

    Are there other cases where you are getting no ActiveRow?