GGC validation

Hi.

I'm using event CurrentRecordContextChange to save data in my table.

Before saving data I want to check if all not null columns have some value inserted. If one or more not null columns are empty user should get message box with an error and option to go back and insert empty values or to undo all changes in current record.

GGC uses DataTable properties to determine not null columns.

I would appreciate sample of this behavior or a code snippet.

Thanks in advance.

1 Reply

AD Administrator Syncfusion Team March 2, 2007 10:37 PM UTC

Hi Srdjan,

You can try the below code snippet and let me know if this helps.

private void gridGroupingControl1_CurrentRecordContextChange(object sender, CurrentRecordContextChangeEventArgs e)
{
if( e.Action == Syncfusion.Grouping.CurrentRecordAction.EndEditCalled)
{
try
{
DataRowView dr = e.Record.GetData() as DataRowView;
if( dr.Row != null)
dr.Row.EndEdit();
}
catch(Exception ex)
{
DialogResult result = MessageBox.Show(ex.Message,"SaveRecord",MessageBoxButtons.OKCancel );
e.Cancel = true;
if( result == DialogResult.OK )
e.Table.CurrentRecord.CancelEdit();
}
}
}

Best regards,
Haneef

Loader.
Up arrow icon