Event when clearing a cell

Sir,

Question 1
what event is raised when I select a cell and then press the delete key to delete its contents?

I understand the Grid.CurrentCellBeginEdit and Grid.CurrentCellEndEdit, but neither of this are fired if you just select a cell with content and press delete. If you double click the cell, to get to the underlying grid, and then press backspace you can (sometimes) get the CurrentCellBeginEdit to fire.

Is there some Spreadsheet event that fires just on deleting data

Question 2
Is there anyway to change the edit mode on SFSpreadsheet so that the grid is edited when the cell is clicked rather than double clicked? For example, if I have a datavalidation on a cell, I need to double click to activate the drop down, a single click selects the cell, but does not activate the drop down

Thanks

1 Reply

TL Thirumurugan Loganathan Syncfusion Team January 18, 2018 04:41 PM UTC

Hi James, 
 
Please find the below details for asked queries, 
 
S.No 
Query 
 
Comments 
1 
what event is raised when I select a cell and then press the delete key to delete its contents? 
 
You can achieve this requirement by invoking the KeyDown event of the spreadsheetGrid and check the condition like whether the delete key is pressed or not. Please find the below code sample for your reference. 
 
 
private void spreadsheet_WorkbookLoaded(object sender, WorkbookLoadedEventArgs args) 
{ 
            spreadsheet.ActiveGrid.KeyDown += ActiveGrid_KeyDown; 
} 
 
private void ActiveGrid_KeyDown(object sender, KeyEventArgs e) 
{ 
            if(e.Key == Key.Delete) 
            { 
                        MessageBox.Show("Pressed Delete key"); 
            } 
} 
 
 
 
2 
Is there any way to change the edit mode on SfSpreadsheet so that the grid is edited when the cell is clicked rather than double clicked?  
 
You can achieve this requirement by invoking the current cell BeginEdit method at the CellClick event as in the below code sample.  
 
 
spreadsheet.ActiveGrid.CellClick += ActiveGrid_CellClick; 
 
private void ActiveGrid_CellClick(object sender, GridCellClickEventArgs e) 
{ 
            //Enter into edit mode at single click based on the below condition. 
            if (spreadsheet.ActiveGrid.CurrentCell.RowIndex == 4) 
                 spreadsheet.ActiveGrid.CurrentCell.BeginEdit(true); 
} 
 


 
 
Regards, 
Thirumurugan 


Loader.
Up arrow icon