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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

event when button of GridButtonColumn is clicked

Thread ID:





144649 May 15,2019 05:11 PM UTC May 16,2019 10:44 AM UTC WinForms 1
Tags: SfDataGrid
Asked On May 15, 2019 05:11 PM UTC

I added a GridButtonColumn to my SfdatagridView so that each row has a button (I want to use it for deleting this row). How is it possible to react on pushing the button of a specific row?

Jagadeesan Pichaimuthu [Syncfusion]
Replied On May 16, 2019 10:44 AM UTC

Hi Hans-Georg, 

Thanks for using Syncfusion product. 

We have checked your requirement to delete the row while button click on the particular row. You can able to achieve your requirement by using the CellButtonClick event. Please refer the below code snippet to delete the record by two different ways. 

// Add the below code in constructor or form loading 
this.sfDataGrid.AllowDeleting = true; 
this.sfDataGrid.Columns.Add(new GridButtonColumn() 
    MappingName = "Quantity", 
    HeaderText = "Remove", 
    AllowDefaultButtonText = true, 
    DefaultButtonText = "Remove this row" 
this.sfDataGrid.CellButtonClick += sfDataGrid_CellButtonClick; 
void sfDataGrid_CellButtonClick(object sender, Syncfusion.WinForms.DataGrid.Events.CellButtonClickEventArgs e) 
    int _Dgdeletingrowindex = sfDataGrid.TableControl.ResolveToRecordIndex(sfDataGrid.CurrentCell.RowIndex); 
    // Delete record by based on the row index 
   // Or you can call the below code the delete the selected record 
   // this.sfDataGrid.DeleteSelectedRecords(); 

We have prepared the simple sample to achieve your requirement. 

Let us know whether this helps also if you need any further assistance on this. 



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon