User (Old forums)MemberJune 15, 2007 at 1:12 amPost count: 23064
I’ve got some strange deleting issues. I’ll post my delete code, then do my best to describe the problems 🙂
private void HandleDeleteRows(DataGridControl dataGridControl)
if (dataGridControl.SelectedItems.Count < 1)
ItemCollection itemCollection = dataGridControl.Items as ItemCollection;
if (itemCollection == null)
int count = dataGridControl.SelectedItems.Count;
for (int i = 0; i < count; i++)
MyObj item = (MyObj)dataGridControl.SelectedItems;
if (item != null)
Deleting a single item works fine. The issues arise when trying to delete multiple rows.
Case A) delete single item == works fine
Case B) ctrl+click to select multiple contiguous rows (as in a solid block of rows) == works fine
Case C) ctrl+click to select multiple NON contiguous rows == FAIL. In this case, after the first iteration through the loop the SelectedItems clears.
Select Rows 1, 2, 3, 6 and 9 == Fail.
Case D) ctrl+click to select multiple NON contiguous rows and then DESELECT the last row == works fine.
Select Rows 1, 2, 3, 6, 9 and 11 and then DESELECT 11 == works fine.
Obviously the deselection of the last row changes something, I just cant work out what. I thought it was related to the location of the ‘black arrow’ (is that for CurrentItem?) but with the contiguous selection the item with the ‘black arrow’ is successfully deleted.
 as it is a contiguous selection shift+click also works
Imported from legacy forums. Posted by Jack (had 4735 views)Xceed SupportMemberJune 19, 2007 at 8:53 amPost count: 5658
Thank you for reporting this…
We will update you in this thread when we have more details.
Imported from legacy forums. Posted by Marcus [Xceed] (had 271 views)Xceed SupportMemberJune 20, 2007 at 4:37 pmPost count: 5658
Can you describe how the deletion “fails”? Is there an exception? Are some items not deleted?
Imported from legacy forums. Posted by Marcus [Xceed] (had 281 views)User (Old forums)MemberJune 20, 2007 at 8:12 pmPost count: 23064
Case C) ctrl+click to select multiple NON contiguous rows == FAIL. In this case, after the first iteration through the loop ***the SelectedItems clears***.
By clears, I mean…well… clears. There are no longer any selected items after the FIRST deletion, even if I had 6 selected.
Is there a preferred/known way to delete items in the samples? The code I’m using was based on several posts in this forum, plus some mucking about. It would be really helpful if Xceed created a sample of how to delete.
Imported from legacy forums. Posted by Jack (had 616 views)User (Old forums)MemberJune 20, 2007 at 9:03 pmPost count: 23064
i probably should re-emphasise that when I DESELECT the last row selected and then try to delete, it all works.
Rows 1, 2, 3, 6, 9 == fails
Rows 1, 2, 3, 6, 9, 11 then deselect 11 == works (as in 1,2,3,6 and 9 are successfully deleted)
Imported from legacy forums. Posted by Jack (had 614 views)Xceed SupportMemberJune 21, 2007 at 8:43 amPost count: 5658
I needed more details just to ensure I was repro-ing the same issues as you encountered…
Either way, I found a quick workaround that would eliminate the issue (in the mean time we fix this behavior)…
If you create a copy of the SelectedItems collection, you can use the copy to cycle through the list of SelectedItems…
object selectedItems = new object[ myGrid.SelectedItems.Count];
myGrid.SelectedItems.CopyTo( selectedItems, 0);
//loop on selectedItems instead of myGrid.SelectedItems
Let me know if you encounter any more problems while using this workaround.
Imported from legacy forums. Posted by Marcus [Xceed] (had 265 views)User (Old forums)MemberAugust 8, 2007 at 2:17 pmPost count: 23064
This issue has been fixed, you can donwload the latest package <a href=”http://xceed.com/pages/TopMenu/Downloads/Trials.aspx”>here </a>
Imported from legacy forums. Posted by Matt (had 5409 views)
- You must be logged in to reply to this topic.