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.

Cannot increase row count inside celleditcomplete handler

Thread ID:

Created:

Updated:

Platform:

Replies:

1819 Nov 27,2002 12:52 PM Dec 3,2002 06:26 AM Windows Forms 2
loading
Tags: GridControl
Darryl Mataya
Asked On November 27, 2002 12:52 PM

We have a class inherited from Grid.Gridcontrol that automatically adds and removes rows based on other events. In one case, when we increase the rowcount (Me.RowCount +=1) it fails to do so. It actually appears to increase it immediately in the debugger, but once we leave the method the rowcount resorts to its prior value. In the case that does this, we are calling our add method that does this from within a handler for CurrentCellEditingComplete. Is this perhaps why the rowcount increase doesn't work here, and then of course what would be a good workaround?

Administrator [Syncfusion]
Replied On November 27, 2002 03:27 PM

The problem is that in the CurrentCellEditingComplete event, the current cell is in the state of deactivating. This poses a problem if you try to increase the row count at this point, because that initiates another deactivating call. One work around available in Version 1.5 is to lock the currentcell while you increase the rowcount. This will avoid the second deactivating call.
private void gridControl1_CurrentCellEditingComplete(object sender, System.EventArgs e)
{
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	cc.Lock();
	this.gridControl1.RowCount++;
	cc.Unlock();
}

Darryl Mataya
Replied On December 3, 2002 06:26 AM

That did it. Thanks Clay. -Darryl

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.

;