We rely on GridView.FocusedRowChanged to refresh controls outside the grid with the related information. But the automatic row (re)focusing does not work consistently.
Consider the following scenario:
-
Grid (with a pager, if it is releveant) is populated with 20 rows
-
User clicks on the last row - it is now focused (GridView.FocusedRowChanged script is called and the rest of the screen changes accordingly)
-
User changes something outside the grid (walks by the tree in our case) and this action calls GridView.PerformCallback()
-
Number of rows in the grid is now less than before (let's say - 10) and the last row is automatically focused, but GridView.FocusedRowChanged script is NOT called!
-
From now always, if user does something that changes row count to:
>=10, then the 10th row is automatically selected
<10, then focus is simply lost.
But in any case GridView.FocusedRowChanged is never fired!
What worse is that GridView.GetFocusedRowIndex() continues to return 9 (10th row) even when grid is left with just single row!
Please, fix the behavior by always focusing a row, if any exists, and firing GridView.FocusedRowChanged whenever focused/selected row VISIBLY chanages.
Hi,
Please check whether or not the ASPxGridViewBehaviorSettings.AllowClientEventsOnLoad option is enabled. If not, enable it. If this does not help and the issue still occurs, please provide us with a self-contained compilable sample (with a portable database or runtime-generated data, if required) so that we can replicate and debug the issue locally. This should help us narrow down the cause of the problem. Thank you for your time and cooperation in advance.
No, enabling this setting did not change the behavior.
I it helps, I refresh the GridView y calling PerformCallback and putting extra (filtering) params in BeginCallback. No other actions/scripts involved that could affect the grid appearence or behavior.
I'll try to come up with a project a bit later.
Yes, in this scenario, it looks like thorough debugging is required to determine the cause of the issue. I am looking forward to your feedback once you have had the opportunity to prepare a sample project.
Alessandro,
Please play the scenario above with the attached demo.
Hello,
Thank you for the project. I was able to reproduce the issue with using your code and I see that this is incorrect behavior and it should be investigated by our developers.
I passed this ticket to our R&D team for further research. We will notify you as soon as we have results.