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

CurrentCellChanging only comes when cell activates (2.1.0.9)

The CurrentCellChanging seems to arrive only when to type in an inactive cell. Once cell activates the event no longer arrives. I''ve observed this even in grid samples where grid events are traced. Is there a way to get a cancelable event on every key-stroke?

4 Replies

AD Administrator Syncfusion Team September 20, 2005 11:27 AM UTC

Hi Mike, CurrentCellchanging,CurrentCellValidateString,CurrentCellKeyPress are fired for each Keystroke not for cell activation. Try CurrentCellValidateString event handler it is fired for each keystroke and it is a cancelable event. Please refer the sample. The sample prevents the user from entering string. It allows only numbers throughout the column two. The line of code e.cancel=true prevents any further action and maintains the focus in the current cell itself till valid value inside the current cell . private void gridControl1_CurrentCellValidateString(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellValidateStringEventArgs e) { GridCurrentCell cc = this.gridControl1.CurrentCell; if (cc.ColIndex==2) { double d; if(!double.TryParse(e.Text, System.Globalization.NumberStyles.Integer, null, out d)) { e.Cancel = true; MessageBox.Show("only numbers"); } } } Here is a sample. intvalidation_gc.zip Hope this helps.Let us know if you need more assistance. Best Regards, Jeba.


AD Administrator Syncfusion Team September 20, 2005 03:03 PM UTC

The CurrentCellChanging does not seem to get fired for each key stroke. It only fires for first key stroke while the editor is inactive in the cell. Simpley add this handler to the VirtualGrid samle you ship: private void HandleCellChanging(object sender, System.ComponentModel.CancelEventArgs e) { Console.WriteLine( "Changing" ); }


AD Administrator Syncfusion Team September 20, 2005 03:14 PM UTC

In addition, the CurrentCellValidateString has a strange bahavior for CellType ComboBox: if you set a e.cancel = true, it clears the value. Just set e.Style.CellType = "ComboBox" on line 63 of Form1.cs in the VirtualGrid project and attach the handler to the event.


MI Mike September 20, 2005 09:45 PM UTC

Both CurrentCellChanging and CurrentCellValidateString seem to have a problem as stated in prior posts.

Loader.
Live Chat Icon For mobile
Up arrow icon