I'd like to move the contents of a selected row's single cell up or down with in the grid based on the user clicking an up or down button.
In the below example row 3 is selected and the user has clicked the UP button. The result shows that the LABEL data for row 2 and row 3 have been switched. I'd also like to move the selected row in the direction indicated with the button push. In this case the selected row moves from row 3 to row 2.
# Label # Label
1 1 1 1
2 2 2 3
3 3 3 2
4 4 4 4
6 Answers, 1 is accepted
I am afraid that RadGridView has no such functionality built-in. Are you aware of any data grid out there that has it?Greetings,
the Telerik team
Why yes I do know of a data grid that does this. However, it's been deprecated and I'm not sure if the ability has been continued in their new line of controls. I'm migrating existing VB6 code to C# and our VB6 code uses Sheridan controls, now Infragistics. That being said of course the old control wasn't using data binding. Not sure this would even be possible with bound data.
I think I can accomplish this with a foreach loop on the bound data. Luckily, there are usually only a few rows in the grid at any one time.
We implements this factuality like this:
private void OnMoveDownButtonCommand(object param)
if (SelectedItem == null) return;
object movedItem = SelectedItem;
int index = ((IList)RadGrid.ItemsSource).IndexOf(movedItem);
if (index >= RadGrid.Items.TotalItemCount - 1) return;
if (index < 0)
index = 0;
if (index % PageSize == PageSize - 1)
RadGrid.SelectedItem = movedItem;
Hope this help
I need to implement the row move up and down in radgrid,each row have up and down imagebuttons.please let me know.
Hi Rossen Hristov,
I need to implement the row move up and down in RadGridView using RadButtons.I am waiting for your reply.
To achieve your requirement you can use the Avi's approach and add the command logic to the buttons command.
I also attached a small example demonstrating an alternative approach. I hope it helps.