The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I am using version 1.5.1.6 of Essential Grid. I have a class derived from the GridControl where I handle sorting when the user clicks on a column header. I make provision for further derived classes to do their own thing before and after the sort operation. For example, most of my instances of the grid are list-box style (row selection) and I usually want a selected row to remain selected after the user clicks on a column header to sort. To do this, I note which row is selected before the sort and after the sort I find and set the selection back to it.
To accomplish this I have an event handler for CurrentCellActivating which 1) checks that the user has clicked on a column header, 2) notes which row is selected in the grid, 3) calls SortByColumn to re-sort the grid, and 4) finds the same data row in the newly sorted grid and calls CurrentCell.MoveTo to re-position the current cell (also clears and sets the selection to that row).
The grid behavior seems to be okay, but when it comes to the call to CurrentCell.MoveTo I am getting an exception that reads "Deactivate called while current cell was in process of activating or deactivating a cell". I tried moving step 4 into an event handler for CurrentCellActivated instead of Activating, but I still see the same error.
Do you know of a way to avoid this exception? Does what I am doing sound correct or is there another/easier way?
Thanks for your help,
Cathy
ADAdministrator Syncfusion Team July 8, 2003 08:20 PM UTC
Instead of calling CurrentCell.MoveTo from within your CurrentCellActivating event, try directly setting e.RowIndex and e.ColIndex to the row and column of the cell you want to activate.
CNCathy NoakesJuly 9, 2003 01:41 PM UTC
Clay,
Thanks once again for the prompt and effective solution! It might have been obvious to me if all of the steps I described had been happening in one place instead of different classes and methods; but I can change my code around a little and make it work.
I appreciate your help,
Cathy