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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Disable a cell and moving away from it

Thread ID:





4715 May 28,2003 07:11 AM UTC Jun 2,2003 01:11 PM UTC WinForms 6
Tags: GridControl
Administrator [Syncfusion]
Asked On May 28, 2003 07:11 AM UTC

Hi, I have a GridControl with the following properties set: this.gridControl.Model.Options.WrapCellBehavior = GridWrapCellBehavior.WrapRow; this.gridControl.EnterKeyBehavior = GridDirectionType.Right; In my last enabled cell in each column, the user can enter an integer. If this integer i 0, the cell's Enabled-property is set to false. I do this listening to the Validating-event. This works fine for all cell's except for the last enabled row in the last column. Here the cursor simply stays in the cell, even though is isn't enabled! I've tried listening to the Validated-event and the using the MoveTo-method, but the a dialogbox, with this error appeas: "Deactive called while the current cell was in process of activating or deactivating a cell"??? Is there a few so solve my problem?

Administrator [Syncfusion]
Replied On May 28, 2003 07:47 AM UTC

Can you use the GridWrapCellBehavior.WrapGrid setting? This will move to the upperleft when you leave the lowerright cell. (It will not leave the current cell where it was which is what I think is happening now). If you can't use WrapGrid, then try handling this event and explicitly moving the current cell where you want it if you are moving off the bottom right cell.
private void gridDataBoundGrid1_QueryNextCurrentCellPosition(object sender, GridQueryNextCurrentCellPositionEventArgs e)
	GridCurrentCell cc = this.gridDataBoundGrid1.CurrentCell;
	if(cc.Renderer.ControlText == "1"
		&& e.ColIndex == this.gridDataBoundGrid1.Model.ColCount + 1
		&& e.RowIndex == this.gridDataBoundGrid1.Model.RowCount 
		//move it back a column
		cc.MoveTo(e.RowIndex, e.ColIndex - 2); 
		e.Handled = true;
		e.Result = false;

Administrator [Syncfusion]
Replied On May 28, 2003 10:49 AM UTC

Well, I can't get WrapGrid working, but instead i discovered NextControlInForm which I can use to move focus... However, I'm not sure I'm using it the right way - is there an example somewhere showing how to use it? I haven't been able to find any...

Administrator [Syncfusion]
Replied On May 29, 2003 10:06 AM UTC

Attached is a try at doing this. You may have to tweak the code to work for your particular situation. It uses WrapGrid and QueryNextCurrentCellPosition to try to handle things. If you type a 0 in the last column that cell becomes disabled and will be skipped the next time you try to enter in.

Administrator [Syncfusion]
Replied On May 29, 2003 10:07 AM UTC

Forgot to attach the sample....

Administrator [Syncfusion]
Replied On June 2, 2003 11:10 AM UTC

Try entering this after InitializeComponent(); in the constructor: gridControl1[1,1].Enabled = false; And then er a 0 (zero) in row 3, column 4... and press Enter until the cursor should jump from row 2 to 3... then nothing happens?

Administrator [Syncfusion]
Replied On June 2, 2003 01:11 PM UTC

You can turn off the WrapGrid and handle all the movement in QueryNextCurrentCellPosition. This way you control exactly the currentcell movement. Attached is a sample.


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

Live Chat Icon For mobile
Live Chat Icon