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
close icon

Restrict deleting a cell value on editable grid

I have an editable grid which consists of columns of type "dropdown" and "text".Now if the user selects the cell and press delete key the value in the cell gets deleted. The issue is: 1. Text box cell type:To restirct deleting the cell value,i have used the following code: private void dgAnalysis_CurrentCellValidateString(object sender, Syncfusion.Windows.Forms.Grid.GridCurrentCellValidateStringEventArgs e) { if((e.Text == "") || (e.Text == DBNull.Value.ToString())) { MessageBox.Show("Null is not the valid value." ); e.Cancel = true; } } Now sometimes this code runs and somtimes allow me to come out of the cell without any error. 2.ComboBox Cell Type : I have set the drop down "ExclusiveChoiceList" property to true. a)Select the value from drop down. b)set focus to some other cell c)Bring the focus to cell in step a. d)Press Delete Key. The value will be deleted from the cell.Also note that the value is not deleted from the combo box. Can you suggest the solution to restrict delete in above two cases.

1 Reply

AD Administrator Syncfusion Team September 16, 2004 12:22 PM UTC

Try handling the grid.Model.ClearingCells event, and set e.Handled = true and e.Result = false if e.RangeList contains a cell you do not want to delete.

Live Chat Icon For mobile
Up arrow icon