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

How can I handle adding new row to a GGC?

How can I handle adding new row to a GGC? What event can I use?

2 Replies

AD Administrator Syncfusion Team January 12, 2007 05:27 AM UTC

Hi Konstantin,

You can specify the AddNewRecord setting of the GroupingGrid with ShowAddNewRecordAfterDetails / ShowAddNewRecordBeforeDetails property. Here is a code snippet to show this.

//For Main Table.
this.grid.TopLevelGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.grid.TopLevelGroupOptions.ShowAddNewRecordAfterDetails = false;

//For NestedTables
this.grid.NestedTableGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.grid.NestedTableGroupOptions.ShowAddNewRecordAfterDetails = false;

//For Child Groups
this.grid.ChildGroupOptions.ShowAddNewRecordBeforeDetails = false;
this.grid.ChildGroupOptions.ShowAddNewRecordAfterDetails = false;

If you want to control the add the new row through AddNewRecord, you need to handle the CurrentRecordContextChange event of the grid. Please find the code snippet below.

private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if(e.Action == CurrentRecordAction.EndEditCalled
&& e.Record.Kind == DisplayElementKind.AddNewRecord )
e.Cancel = true;
}

Best Regards,
Haneef


AD Administrator Syncfusion Team January 15, 2007 08:13 AM UTC

Thank you Haneef, next hint was helpful

------------
private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if(e.Action == CurrentRecordAction.EndEditCalled
&& e.Record.Kind == DisplayElementKind.AddNewRecord )
e.Cancel = true;
}
------------

Loader.
Live Chat Icon For mobile
Up arrow icon