This is a migrated thread and some comments may be shown as answers.

DeleteSelected error

1 Answer 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe Loux
Top achievements
Rank 1
Joe Loux asked on 11 Aug 2008, 09:29 PM
If I select 2 rows in my grid that are right on top of each other (ex. index 7 and index 8) it deletes the on with the lowest index (7) before the one with the highest. This changes the dataset and cause the wrong records to be deleted. Is there any way to have the higher index deleted first? Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 12 Aug 2008, 07:12 AM
Hello Joe,

Try the following code on ItemCommand
for (int item = RadGrid1.SelectedItems.Count - 1; item >= 0; item--) 
    Hashtable itemValues = new Hashtable(); 
    e.Item.OwnerTableView.ExtractValuesFromItem(itemValues, (GridEditableItem)RadGrid1.SelectedItems[item]); 
    SqlDataSource1.DeleteParameters["ShipperID"].DefaultValue = itemValues["ShipperID"].ToString(); 
    SqlDataSource1.Delete(); 

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Joe Loux
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or