Link to home
Start Free TrialLog in
Avatar of TMHPROG
TMHPROG

asked on

Changeing the order of records in a bound datagrid using Up/Down buttons

My users would like to reorder the records in a bound datagrid by using Up/Down buttons.  The DG also manages additions/deletetions of records.  I have tried adding a field in the table to hold the SortOrderValue.  When moving a record up or down I can increase/decrease the SortOrderValue by 1 and rewrite the record to the database, but how do I change the SortOrderValue of the "other" record that is being reordered?   I guess what I'm asking is after updating the SortOrderValue for the selected record, how do I determine which other record will be affected so I can correct its SortOrderValue.

Thanks in advance,

Scott
Avatar of wguerram
wguerram

Use a CurrencyManger to loop through all records next to the record you change and set previous order value + 1
ASKER CERTIFIED SOLUTION
Avatar of Diego Pazos
Diego Pazos
Flag of Uruguay image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial