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.

GridGroupingControl: Strange behavior.

Thread ID:

Created:

Updated:

Platform:

Replies:

15776 Jun 28,2004 03:17 AM Jun 28,2004 04:38 AM Windows Forms 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On June 28, 2004 03:17 AM

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.

Administrator [Syncfusion]
Replied On June 28, 2004 04:38 AM

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

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.

;