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.

CurrentCellAcceptedChanges not invoked again after bad input

Thread ID:

Created:

Updated:

Platform:

Replies:

33396 Aug 18,2005 02:41 PM Aug 22,2005 06:07 PM Windows Forms 5
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 18, 2005 02:41 PM

I am validing cell input with an event handler connected to the CurrentCellAcceptedChanges event. When I trap bad input, I display a message and then set e.Cancel to true and return. The cell correctly stays in "edit mode", but if the user just pressed the tab key without making any corrections to the input, the grid just activates the next cell, it does not re-fire the CurrentCellAcceptedChanges event. This means the bad input is kept in that case. Is there some other property that must be set in my event handler so the grid know it has to refire the event after a failed validation?

Administrator [Syncfusion]
Replied On August 18, 2005 07:02 PM

You should try using CurrentCellValidating to validate the your user''s input.

Administrator [Syncfusion]
Replied On August 22, 2005 10:25 AM

CurrentCellValidating is not being invoked for me if the cell is activated, but not in editmode. i.e. I have my grid setup to function like excel--click on a cell, start to type just replaces the text, then tab. CurrentCellValidating is not invoked. If I dbl click the cell or press F2 to put it into edit mode, then the CurrentCellValidating is called, but if I press esc to stop the edit I can tab to the next cell, even though bad data exists in the cell. >You should try using CurrentCellValidating to validate the your user''s input.

Administrator [Syncfusion]
Replied On August 22, 2005 10:42 AM

CurrentCellValidating should be hit anytime your user makes a change in the cell (and does not cancel the change by pressing escape which should restore the cell to the original valid state). How do I see the problem you are having in this sample? Are you handling events or have other property setting that might be inteferring with the standard behavior of the grid? Or am I missing something? http://www.syncfusion.com/Support/user/uploads/GDBG_1a963169.zip

Administrator [Syncfusion]
Replied On August 22, 2005 05:56 PM

The following CurrentCellDeactivating handler is the problem. I had added the following handler based on your previous responses on how to make a right click not activate the current cell. I want excel-like behavior where rt click just brings up the context menu w/o activating the current cell. When this handler is in place the CurrentCellValidating handler is not called when tabbing from an active, but not editing cell. private void TheGrid_CurrentCellDeactivating(object sender, CancelEventArgs e) { if(_lockForForMouseUp) { e.Cancel = true; _lockForForMouseUp = false; } else if(Control.MouseButtons == MouseButtons.Right) { int row, col; Point pt = this.gridDataBoundGrid1.PointToClient(Control.MousePosition); if(this.gridDataBoundGrid1.PointToRowCol(pt, out row, out col) && this.gridDataBoundGrid1.Selections.Ranges.AnyRangeContains(GridRangeInfo.Cell(row, col))) { e.Cancel = true; _lockForForMouseUp = true; } } } >CurrentCellValidating should be hit anytime your user makes a change in the cell (and does not cancel the change by pressing escape which should restore the cell to the original valid state). > >How do I see the problem you are having in this sample? Are you handling events or have other property setting that might be inteferring with the standard behavior of the grid? Or am I missing something? >http://www.syncfusion.com/Support/user/uploads/GDBG_1a963169.zip >

Administrator [Syncfusion]
Replied On August 22, 2005 06:07 PM

>>when tabbing from an active, but not editing cell. What does this mean? CurrentCellValidating should be hit when you leave the cell only if the cell was modified by the user. The cell being acive (showing an edit cursor) is not sufficient to trigger the event. Is this the case you are trying to catch, when you leave an active, unchanged cell?

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.

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.

;