The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
We are allowing user to delete current row by using the delete key. That works fine. (see the 2 routines below) The first routine is called from the Rowdeleted event.
The problem is,,, when you are editing the contents of a cell and you hit the delete key, then the code attempts to delete the row.
I was able to put code in to detect that the cell was in edit mode, and then cancelled the delete. However, the delete key did not delete the character in the cell.
Any ideas?
Thanks in advance.
private void deleteRowHandler(object sender, GridRowRangeEventArgs e) { // THIS IS CALLED FROM ROWDELETING EVENT deleteRow(e); }
private void deleteRow(GridRowRangeEventArgs e) {
int iCxOverRowCnt; int CxOverID = 0; string moa_from = null; string moa_to = null; string confirmMsg = null;
try {
iCxOverRowCnt = (int)this.getGridRowCount(this.gridDataBoundGridChangeover); if (iCxOverRowCnt > 0) {
DataRowView drv = this.getDataRowView(this.gridDataBoundGridChangeover); CxOverID = (int)drv["ID"]; moa_from = (string)drv["MOA_FROM"]; moa_to = (string)drv["MOA_TO"]; confirmMsg = "OK to Delete? Material # FROM " + moa_from + " Material # To " + moa_to;
DialogResult result = MessageBox.Show(confirmMsg, "Delete Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { CurrencyManager cm = (CurrencyManager)this.BindingContext[this.gridDataBoundGridChangeover.DataSource];
if (cm != null && cm.Count > 0) {
DataRowView dr = this.getDataRowView(this.gridDataBoundGridChangeover);
if (this.gridDataBoundGridChangeover.Binder.IsEditing) this.gridDataBoundGridChangeover.Binder.EndEdit();
dr.Delete(); this.oleDbChangeover.Update(this.datasetChangeover.CHANGEOVER_DETAILS); e.Cancel = true; // If we delete an item from the bottom grid, we need to reload from and to grids becuase the // deleted moa is now available as a "from" candidate. this.loadGrids(); } } catch (Exception excep) { e.Cancel = true; this.datasetChangeover.RejectChanges(); eventHandler.DisplayFatalError("deleteRow", "Unable to delete Setup Performance record", excep); } } else { e.Cancel = true; this.datasetChangeover.RejectChanges(); //eventHandler.DisplayFatalError("deleteRow", "Unable to delete changeover record", excep); } } } catch (Exception ex) { eventHandler.DisplayFatalError("deleteRow", "Error deleting Setup Performance record", ex); } }