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

Prevent leaving GDBG when editing

Thread ID:





44891 Jun 6,2006 02:06 PM UTC Jun 7,2006 09:31 AM UTC WinForms 3
Tags: GridControl
Asked On June 6, 2006 02:06 PM UTC

Hi, I''m using a GridDataBoundGrid and i want to prevent the user to leave the grid while he is editing it (by pressing buttons on the form). I''ve tried implenting validating, leave and lostfocus of the grid, but still is possible to press these buttons. How can i do this? Thank you

Administrator [Syncfusion]
Replied On June 7, 2006 05:27 AM UTC

Hi Borja, Handling the gridDataBoundGrid1.Validating event and setting e.Cancel to true if the current cell is in the edit mode prevents the user from leaving the grid. Attached is a sample. Let us know if this serves your need. Regards, Calvin.


Replied On June 7, 2006 07:43 AM UTC

Actually i already implement Validating event and set e.Cancel to true if editing, and it works when i click on a control that gets the focus, but not in other controls. The attached file is the modified example. I added a toolstrip, the label in it is clicked the grid loses the focus (even with Validating event).

43529 modified.zip

Administrator [Syncfusion]
Replied On June 7, 2006 09:31 AM UTC

Hi Borja, This is the default behavior of .Net: when the focus is moved to a control that doesn’t causes validation, the control’s Validating event won’t be fired. Try checking, if the current cell is in the edit mode in the toolStripLabel1.Click event to see if that helps. private void toolStripLabel1_Click(object sender, EventArgs e) { if(!this.gridDataBoundGrid1.CurrentCell.IsEditing) MessageBox.Show("Grid lost focus"); } Regards, Calvin.


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

or the page will be automatically redirected to 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