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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrentCell activate/deactivate problem

Thread ID:

Created:

Updated:

Platform:

Replies:

5567 Jul 8,2003 06:02 PM UTC Jul 9,2003 01:41 PM UTC Windows Forms 2
loading
Tags: GridControl
Cathy Noakes
Asked On July 8, 2003 06:02 PM UTC

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

Administrator [Syncfusion]
Replied On 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.

Cathy Noakes
Replied On July 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;