Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
How to determine the order of selected rows?
posted

Hi there,

I successfully implemented row drag & drop as described in the knowledge base. The only drawback I have is the order of the dragged rows. So when the user has selected the rows 3,6,9 and 12 I want to move the rows in exactly that order. But the SelectedRowsCollection does not save the order so I get inpredictable results when dragging the rows (like the new order is 9,6,12 and 3).

I tried to sort the selected rows using LINQ by row.Index but it does not seem to work because the row indices seem to change every time the user drags the selection.

Thank you for any help.

Achim

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    The rows in the Selected.Rows collection will be in the order in which they were selected. But I imagine you probably want them in the order in which they appear in the grid.

    moojoo said:
    I tried to sort the selected rows using LINQ by row.Index but it does not seem to work because the row indices seem to change every time the user drags the selection.

    That's the hard way to do it. The easy way is to call:

    this.ultraGrid1.Selected.Rows.Sort();

     

Children
No Data