Delete Row Event

For the GridDataControl, if I set AllowDelete="True", is there an easy way to customize the confirmation dialog on delete? Also, is there an event for handling the delete, I don't see how I can be notified when the delete is coming from the Delete key (AllowDelete=True").

Any suggestions would be appreciated.

3 Replies

GT Gnanasownthari Thirugnanam Syncfusion Team December 12, 2017 12:05 PM UTC

Hi Mike, 

You can get the notification in RecordDeleting event before delete the record, also you can customize the Dialog box inside the RecordDeleting event like below code example. 

this.dataGrid.Model.Table.RecordDeleting += Table_RecordDeleting;      
 
//RecordDeleting event is triggered for DeleteKey, you cna use the event for delete purpose and you can customize the dislog box here. 
void Table_RecordDeleting(object sender, GridDataRecordDeletingEventArgs args) 
{ 
    //Need to set the args.Handled as true for skip to show the default dialog box. 
    if (MessageBox.Show("Are you want to delete the record", "", 
            MessageBoxButton.OKCancel, MessageBoxImage.Question, MessageBoxResult.OK) == 
            MessageBoxResult.Cancel) 
    { 
        args.Cancel = true; 
    } 
    args.Handled = true; 
} 

We have prepared the sample based on your requirement, you can download it from below mentioned location. 
Sample location: 

Please let us know if you need further assistance on this. 

Regards, 
Gnanasownthari T. 



MA Mike Anderson December 13, 2017 03:18 PM UTC

Exactly what I was looking for - thanks!


GT Gnanasownthari Thirugnanam Syncfusion Team December 13, 2017 03:52 PM UTC

Hi Mike, 
 
Thank you for your update. 
 
Please let us know if you need further assistance on this. 
 
Regards, 
Gnanasownthari T. 


Loader.
Up arrow icon