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
close icon

Prevent leaving GDBG when editing

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

3 Replies

AD Administrator Syncfusion Team 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.

43529.zip


BO Borja 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


AD Administrator Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon