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

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.
Live Chat Icon For mobile
Up arrow icon