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

Cannot increase row count inside celleditcomplete handler

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?

2 Replies

AD Administrator Syncfusion Team November 27, 2002 08:27 PM UTC

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();
}


DM Darryl Mataya December 3, 2002 11:26 AM UTC

That did it. Thanks Clay. -Darryl

Loader.
Live Chat Icon For mobile
Up arrow icon