Hi Eren,
Thanks for using Syncfusion products.
If you want to avoid adding the empty record through AddNewRow itself, then adding the new row can be avoided by validating the row in RowValidating event. Please refer to the code example and the sample in the following location.
Code Example:
|
sfDataGrid.RowValidating += SfDataGrid_RowValidating;
private void SfDataGrid_RowValidating(object sender, Syncfusion.WinForms.DataGrid.Events.RowValidatingEventArgs e)
{
var id = (e.DataRow.RowData as DataRowView).Row[0];
var value = id != null ? id.ToString() : string.Empty;
if (string.IsNullOrEmpty(value))
{
e.ErrorMessage = "Employee ID cannot be null";
e.IsValid = false;
}
} |
Sample Location:
Regards,
Amal Raj U.