Remove 0 and Set null value from keyboard

Hi, 

We have a requirement like if cell has 0 value and user try  to remove 0 through keyboard then sfdataGrid control should be able to replace 0 with null in the selected cell. And Valuechanged event should fire so we should get to know that value has changed.


3 Replies 1 reply marked as answer

KK Karthikraja Kalaimani Syncfusion Team March 31, 2021 09:48 AM UTC

Hi Rahul,

If you want to get notify when enter key is pressed through keyboard means please hook CurrentCellEndEdit event of the SfDataGrid. If you want to get notify whenever the value is changed in GridCell means please hook the ValueChanged event of the SfDataGrid.

Code snippet :

 
….
  dataGrid.CurrentCellEndEdit += DataGrid_CurrentCellEndEdit;
 
  dataGrid.ValueChanged += DataGrid_ValueChanged; 
…. 
 
        private void DataGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e) 
        { 
             
        } 
        private void DataGrid_ValueChanged(object sender, Syncfusion.SfDataGrid.XForms.ValueChangedEventArgs e) 
        { 
           
        } 

We hope this helps, please let us know if you need further assistance on this.

Regards,
Karthik Raja
 



RR Rahul Rathore March 31, 2021 10:29 AM UTC

We already tried these events but the problem is when you try to remove 0 from the cell, ValueChanged event will not fire. How we will get to know that user has explicitly removed 0 from cell.


KK Karthikraja Kalaimani Syncfusion Team April 1, 2021 01:32 PM UTC

Hi Rahul,

We have checked in simple sample. And we saw the ValueChanged event is fired whenever remove characters from a cell. We have attached the tested sample for your reference.

Sample link :  https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridDemo2117504180.zip
 


 
Please check the sample and if you still face the same issue, please modify the attached sample based on the scenario you used to reproduce the issue.


Regards,
Karthik Raja
 


Marked as answer
Loader.
Up arrow icon