Using a DevExpress XtraGrid and Trying to Move Records Up or Down


Author
Message
Buffie
Buffie
Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)
Group: StrataFrame Users
Posts: 119, Visits: 11K
I have a DevExpress XtraGrid filled with a Business Binding Source. I am trying to follow a Sample that allows user to move a record up or down by clicking a button.

But, the Sample uses a DataTable and not a BBS or BO so I am having trouble converting some of the code.

Dim view As GridView = gridView1
view.GridControl.Focus()
Dim index As Integer = view.FocusedRowHandle
If index <= 0 Then
Return
End If
Dim row1 As DataRow = view.GetDataRow(index)
Dim row2 As DataRow = view.GetDataRow(index - 1)
Dim val1 As Object = row1(OrderFieldName)
Dim val2 As Object = row2(OrderFieldName)
row1(OrderFieldName) = val2
row2(OrderFieldName) = val1
view.FocusedRowHandle = index - 1


What I am not sure how to convert is the lines that involve the DataRows.

I would appreciate any help I could get and if anyone has a Xtragrid allowing moving records I would appreciate any hints or advice.

TIA


Replies
Buffie
Buffie
Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)Advanced StrataFrame User (573 reputation)
Group: StrataFrame Users
Posts: 119, Visits: 11K
Alright the Following Seems to Work but any ideas of a better way to do it or the Correct way to do it would be appreciated.

Dim row1 As DataRow = Me.ResultsPerfsChecksTimedEventBO1.CurrentRow()
Me.ResultsPerfsChecksTimedEventBO1.MovePrevious()
Dim row2 As DataRow = Me.ResultsPerfsChecksTimedEventBO1.CurrentRow()
Me.ResultsPerfsChecksTimedEventBO1.MoveNext()
Dim val1 As Object = row1("JudgesSheetPositionNumber")
Dim val2 As Object = row2("JudgesSheetPositionNumber")
row1("JudgesSheetPositionNumber") = val2
row2("JudgesSheetPositionNumber") = val1


Now on to the part of Mouse Drag and Drop.

 


Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Terry,

I downloaded the demo yesterday but could not get back to it.

I will review it now with your code changes and get back in a few.

Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search