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
sfDataGrid.View.RemoveAt(_Dgdeletingrowindex);
// 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.
Regards,
Jagadeesan