private void MarkersGrid_AddingRecord(object sender, CancelEventArgs e) { var currentRow = MarkersGrid.CurrentRow; if (currentRow != null && currentRow.RowType == RowType.NewRecord) { var marker = currentRow.DataRow as MarkerGridRow; if (marker != null) { if (marker.IsValid()) { UpdateMarker(marker, marker.GetMarkerSettings()); } else { e.Cancel = true; MarkersGrid.CancelCurrentEdit(); } } } }