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.

Prevent leaving GDBG when editing

Thread ID:

Created:

Updated:

Platform:

Replies:

44891 Jun 6,2006 10:06 AM Jun 7,2006 05:31 AM Windows Forms 3
loading
Tags: GridControl
Borja
Asked On June 6, 2006 10:06 AM

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 01:27 AM

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

Borja
Replied On June 7, 2006 03:43 AM

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 05:31 AM

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.

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.

;