triggering event from outside of the control

Hi
I'm trying to trigger the CurrentRecordContextChange event from outside of a GridGroupingControl. I'm tryng to do this so the event would be raised when I close the Parent form which holds my GridGruopingControl.

Essentially I whish to overrire the form's OnClose() method to raise GridGroupingControl's CurrentRecordContextChange event.

Is there a way I can do this?

1 Reply

AD Administrator Syncfusion Team March 16, 2007 02:44 PM UTC

Hi Vicko,

If you wan to trigger the CurrentRecordContextChanged event of the grid then need to move the current record to some other position in a grid. Here is a code snippet to show this.

Record rec = this.gridGroupingControl1.Table.CurrentRecord;
if( rec != null)
{
int index = this.gridGroupingControl1.Table.Records.IndexOf(rec);
if( index > 0 )
this.gridGroupingControl1.Table.Records[index -1].SetCurrent();
else if (index == 0 )
this.gridGroupingControl1.Table.Records[1].SetCurrent();
}
else
this.gridGroupingControl1.Table.Records[0].SetCurrent();

Best regards,
Haneef

Loader.
Up arrow icon