Hi,
Can anyone help me out for this issue, I tried to drag and drop multiple selected rows to a different row position within same band/grid, the rows dropped correctly to the specified index but it changes the order of the selected rows in a reversed order.
That happened only when the dropped index is greater than the 1st selected rows index or the rows are selected in an alternate manner.
Example:
Row 1 - selected
Row 2
Row 3 - selected
Drop selected Row1 and Row3 into index Row 2. it became
Row3
Row 1
Any idea ?
Thanks
Well, the grid doesn't have any built in drag and drop functionality for rows. So this must be something in your code. My guess is that you are looping through the rows in order and moving them one at a time. But once you place Row 1, the rows you are dropping onto have changed. So you need to either loop through the rows backward when dropping, or else drop each row at one position down from the previous dropped row.
either way doesnt work. 1st, i make a debug breakpoint to check the value for looping backward. the value are correctly looping from the last to the 1st selected rows. but after the process is done, the grid still shown in reversed way. 2nd, if drop each row at one position down from the previous dropped row, it will be out of index if i drop a row to the last row index.
My code:If Grid.Selected.Rows(Grid.Selected.Rows.Count - 1).Index > dropIndex Then For i As Integer = Grid.Selected.Rows.Count - 1 To 0 Step -1 uwg.Rows.Move(Grid.Selected.Rows(i), dropIndex) NextElse For i As Integer = 0 To Grid.Selected.Rows.Count - 1 Grid.Rows.Move(uwg.Selected.Rows(i), dropIndex) NextEnd If
That trick only can solved the problem from dragging the selected rows to an index that is below or after the last selected rows index to prevent it in a reversed order. BUT, if selected altenate rows and dropped in the middle of the selected rows, it still blown.
please assists, thank you.