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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

remove rows from multi-select

Thread ID:

Created:

Updated:

Platform:

Replies:

70795 Jan 1,2008 02:22 PM UTC Jan 4,2008 08:07 PM UTC WinForms 2
loading
Tags: GridControl
Joseph Rezuke
Asked On January 1, 2008 02:22 PM UTC

What is the best way to remove a range of selected rows from a non bound grid. I tried to use the following but list.Count returns 0 after the first row is removed.

GridRangeInfoList list;
while (true)
{
list = grid.Selections.GetSelectedRows(true, false);
if (list.Count == 0)
break;

GridRangeInfo range = list[0];
int row = range.Top;

grid.Model.Rows.RemoveRange(row,row );
}


Joseph Rezuke
Replied On January 1, 2008 04:01 PM UTC

Let me add to this; this only happens when the selected rows are not contiguous! If the rows are contiguous then it works fine.

>What is the best way to remove a range of selected rows from a non bound grid. I tried to use the following but list.Count returns 0 after the first row is removed.

GridRangeInfoList list;
while (true)
{
list = grid.Selections.GetSelectedRows(true, false);
if (list.Count == 0)
break;

GridRangeInfo range = list[0];
int row = range.Top;

grid.Model.Rows.RemoveRange(row,row );
}




haneefm [Syncfusion]
Replied On January 4, 2008 08:07 PM UTC

Hi Joe,

Please try these code snippet to remove the selected rows in a grid.

GridRangeInfoList list;
list = gridControl1.Selections.GetSelectedRows(true, false);

for(int i = list.Count -1 ;i>=0;i--)
{
GridRangeInfo range = list[i];
this.gridControl1.Model.Rows.RemoveRange(range.Top, range.Bottom);
}

Best regards,
Haneef


CONFIRMATION

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.

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

;