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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CurrentCellChanged vs. Undo

Thread ID:





73726 May 15,2008 05:43 PM UTC May 26,2008 11:39 AM UTC WinForms 1
Tags: GridControl
Administrator [Syncfusion]
Asked On May 15, 2008 05:43 PM UTC

Hi - we have a GridDataBoundGrid with a CurrentCellChanged handler. This handler performs certain application logic, and overall we are satisfied with the way it works. When the user types into a text box, we see an event fired for each character, and that is fine with us.

However, it seems that if the user presses Control-Z to Undo changes, the CurrentCellChanged handler is not fired for the new value. This causes our application logic to not be invoked, which is a problem.

I read an old post and tried handling the Model.SaveCellInfo handler, but this does not seem to do the trick either, and furthermore only seems to get invoked when after current cell is changed.

I was wondering if there is any way to have the result of Undo call our CurrentCellChanged handler, or some alternative ? Thanks for any assistance !


Sri Rajan [Syncfusion]
Replied On May 26, 2008 11:39 AM UTC

Hi Rob,

Thank you for your patience.

If your intention is to call the currentcellchanged event while undo(ie., while pressing Ctrl+Z), you need to handle CurrentCellKeyDown event, then check if Ctrl+Z key is pressed, if so you need to set the IsModified property of CurrentCell to true and set the ControlText property of CurrentCell. Please refer the below code for more details.

void gridDataBoundGrid1_CurrentCellKeyDown(object sender, KeyEventArgs e)
string s = e.KeyCode.ToString();
bool skipit = false;
if (e.KeyCode == Keys.Control)
skipit = true;

if (!skipit)
KeysConverter con = new KeysConverter();
if (e.Control && e.KeyCode == Keys.Z)
this.gridDataBoundGrid1.CurrentCell.IsModified = true;
GridCurrentCell cc=this.gridDataBoundGrid1.CurrentCell;
this.gridDataBoundGrid1.CurrentCell.Renderer.ControlText = this.gridDataBoundGrid1.Model[cc.RowIndex,cc.ColIndex].Text;

Here is the minimal sample which solves this issue.

Please let me know if this helps.

Best Regards,


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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