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

How do I delete multiple selected ranges of rows in a GridDataBoundGrid?

Platform: WinForms |
Control: GridDataBoundGrid(Classic)


Grid's row deleting support only handles a single range. You can see this in the rowsdeleting event which only have From and To members which will not handle multiple ranges.The attached sample handles the RowsDeleting event to delete multiple ranges of rows.


bool indeleting = false;

private void gridDataBoundGrid1_RowsDeleting(object sender, Syncfusion.Windows.Forms.Grid.GridRowRangeEventArgs e)




indeleting = true;

GridRangeInfoList rangeList = this.gridDataBoundGrid1.Selections.GetSelectedRows(true, false);

if(rangeList.Count > 1)



int nRanges = rangeList.Count;

for(int i = 0; i < nRanges; ++i )


GridRangeInfo r = rangeList[0];

int bottom = r.Bottom;

for(int j = 1; j < rangeList.Count; ++j)


if(rangeList[j].Bottom > bottom)


r = rangeList[j];

bottom = r.Bottom;




this.gridDataBoundGrid1.Binder.RemoveRecords(r.Top - 1, r.Bottom - 1);


e.Cancel = true;


indeleting = false;




Private indeleting As Boolean = False

Private Sub gridDataBoundGrid1_RowsDeleting(ByVal sender As Object, ByVal e As

Syncfusion.Windows.Forms.Grid.GridRowRangeEventArgs) Handles gridDataBoundGrid1.RowsDeleting

If (Not indeleting) Then

indeleting = True

Dim rangeList As GridRangeInfoList = Me.gridDataBoundGrid1.Selections.GetSelectedRows(True, False)

If rangeList.Count > 1 Then


Dim nRanges As Integer = rangeList.Count

Dim i As Integer = 0

Do While i < nRanges

Dim r As GridRangeInfo = rangeList(0)

Dim bottom As Integer = r.Bottom

Dim j As Integer = 1

Do While j < rangeList.Count

If rangeList(j).Bottom > bottom Then

r = rangeList(j)

bottom = r.Bottom

End If

j += 1



Me.gridDataBoundGrid1.Binder.RemoveRecords(r.Top - 1, r.Bottom - 1)

i += 1


e.Cancel = True

End If

indeleting = False

End If

End Sub

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

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

Up arrow icon

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