GDBG Deleting Columns

Hi, I am using a GDBG and I want only certain columns to be editable...this works fine..only problem is, when the user selects an entire column by clicking the header and presses the delete key, the entire data in all the cells of that column are deleted, i tried lotsa events, but none of them seem to be catching the delete keypress. I am attaching the code file. Please help me out on this. Regards, Osden Pereira. Request_5448.zip

1 Reply

AD Administrator Syncfusion Team September 30, 2005 01:43 AM UTC

There are two ways to avoid the Delete key clearing cells. 1) Derived from GridDataBoundGrid and override the ShouldDeleteKeyClearCells method. This is how the default version looks like: protected virtual bool ShouldDeleteKeyClearCells() { if (!Model.Options.ExcelLikeCurrentCell) { return Model.SelectedRanges.Count > 0; } else { return Model.SelectedRanges.Count > 1 || Model.SelectedRanges.Count == 1 && !CurrentCell.RangeInfo.Contains(Model.SelectedRanges[0]); } } 2) Another options is to listen to the ClearingCells event. In your event handler set e.Handled = true if the selected range is a column. Stefan

Loader.
Up arrow icon