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

GridGroupingControl: Strange behavior.

Hello. I using GridGrouingControl. I need some workaround when new row added. Your team provide me next code: private void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlCancelEventArgs e) { Element el = this.gridGroupingControl1.TableControl.Table.CurrentElement; if(el != null && el is GridAddNewRecord) { this.gridGroupingControl1.Table.AddNew(); Record r = el as Record; // Do something } } But it occured anytime I start to edit cell from this row. Actually I should handle only once, when start to edit new row. Is it possible ? Thanks. Vadim.

1 Reply

AD Administrator Syncfusion Team June 28, 2004 08:38 AM UTC

You can try setting a flag so your code is only hit once per new row. To reset it, you can handle the TableControlCurrentCellMoving.
private bool doOncePerNewRow = true;
private void gridGroupingControl1_TableControlCurrentCellStartEditing(object sender, GridTableControlCancelEventArgs e)
{
	Element el = e.TableControl.Table.CurrentElement;
	if(doOncePerNewRow && el != null && el is GridAddNewRecord)
	{
		doOncePerNewRow = false;
		e.TableControl.Table.AddNew();
		Record r = el as Record;
		Console.WriteLine("oncePerNewRow");
	}
}

private void gridGroupingControl1_TableControlCurrentCellMoved(object sender, GridTableControlCurrentCellMovedEventArgs e)
{
	if(e.TableControl.CurrentCell.MoveToRowIndex != e.TableControl.CurrentCell.MoveFromRowIndex)
		doOncePerNewRow = true;
}

Loader.
Live Chat Icon For mobile
Up arrow icon