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

Moving items in Grid with buttons instead of drag and drop

1 Answer 217 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bhupinder Singh
Top achievements
Rank 1
Bhupinder Singh asked on 01 Dec 2011, 01:14 PM
Hi,

I have a requirement from our clients. They would like to have up and down buttons ( like you have in list box) to move items up and down in a Rad Grid. They don'T want to use drag and drop functionality already provided with the Rad Grid. Is there a way that I can achieve this with Grid?


Thanks

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 06 Dec 2011, 11:30 AM
Hi,

This functionality is not available out of the box, you need to implement it by yourself. The steps you should follow are:

  • Disable multi-row selection, otherwise you will end up with complicated logic for checking which item to move.
  • Get the index of the currently selected item and increment it with one on every button press.
  • When the button is pressed you should chose whether to swap the moved item and the next item or reorder all the remaining items.

However all of these operations should be done in the datasource, because when RadGrid performs operations which requires Rebind, like Pagin, Sorting, Filtering and others, item will be reverted to their previous order. To prevent this you should apply the reordering on the datasource too.


You could check the following online resources for more information how to implement this:

Move grid rows up and down.
RadGrid items reorder using DB backend.

Regards,
Andrey
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
Bhupinder Singh
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or