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

ListBoxSelectionMode.One/DEL key in GDBG

Hi Stefan When I set the ListBoxSelectionMode.One in a GDBG, the delete key will remove the whole row. How can I change the behaviour of the del key that I''m able to delete the selected text in a grid cell while editing the cell? Regards Thomas

2 Replies

AD Administrator Syncfusion Team February 11, 2005 07:28 AM

Thomas, there are two options: 1) Set ActivateCurrentCellBehavior & GridCellActivateAction.SetCurrent) != 0) - or - 2) override HandleBoundCurrentCellKeyDown and check for e.KeyCode == Keys.Delete and don''t call base class. Right now this is the code that gets excecuted in GridDataBoundGrid.HandleBoundCurrentCellKeyDown else if (e.KeyCode == Keys.Delete) { GridRangeInfo range = Selections.Ranges.ActiveRange; if (range.IsRows || range.IsTable) { if (Model.Options.ListBoxSelectionMode != SelectionMode.None && CurrentCell.IsEditing && (Model.Options.ActivateCurrentCellBehavior & GridCellActivateAction.SetCurrent) != 0) return; if (range.IsRows) DeleteRecordsAtRowIndex(range.Top, range.Bottom); else if (range.IsTable) DeleteRecordsAtRowIndex(Binder.ListManagerPositionToRowIndex(0), Binder.ListManagerPositionToRowIndex(Binder.RecordCount-1)); e.Handled = true; } Additionally you should also handle either the OnKeyDown or OnClearingCells event for the case that you press DELETE when the current cell is not in edit mode. Stefan >Hi Stefan > >When I set the ListBoxSelectionMode.One in a GDBG, the delete key will remove the whole row. How can I change the behaviour of the del key that I''m able to delete the selected text in a grid cell while editing the cell? > >Regards >Thomas


AD Administrator Syncfusion Team February 11, 2005 10:26 AM

Hi Stefan, Thanks for the code. Regards, Thomas

Loader.
Live Chat Icon For mobile
Up arrow icon