Hi Jiamingliang,
Thanks for using Syncfusion product.
Your requirement can be achieved by enable the AllowDeleting property to true and then add the records in SelectedItems property before calling the DeleteSelectRecords method. Please find the code snippet below to achieve your requirement,
// Add in constructor
this.sfDataGrid1.AllowDeleting = true;
private void button1_Click(object sender, EventArgs e)
{
var records = sfDataGrid1.View.Records;
sfDataGrid1.SelectedItems.Clear();
foreach (var record in records)
{
var dataRowView = record.Data as DataRowView;
if (dataRowView != null)
{
var selected = dataRowView.Row["select"];
if (selected.GetType() != typeof(DBNull) && (bool)selected)
{
sfDataGrid1.SelectedItems.Add(record.Data);
}
}
}
sfDataGrid1.DeleteSelectedRecords();
} |
Please find the sample from below link,
Before deleting records please find the screen shot below,
And please find the below screen shot which after delete the records,
If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further.
Regards,
Jagadeesan