We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CurrentCell activate/deactivate problem

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

2 Replies

AD Administrator Syncfusion Team July 8, 2003 04:20 PM

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.


CN Cathy Noakes July 9, 2003 09:41 AM

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

Loader.
Live Chat Icon For mobile
Up arrow icon