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

Reordering of GridView Rows and Columns by dragging them

4 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dhileep Kumar Sampath
Top achievements
Rank 1
Dhileep Kumar Sampath asked on 17 Nov 2009, 07:08 PM
Hi All,
     I have to allow the users to reorder both the rows and columns of a gridview by dragging RowIndicator and column header respectively and dropping them in desired position.  If there is some sample available for this, it will be really helpful for me.

Thanks,
Dhileep

4 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 18 Nov 2009, 07:08 AM
Hi,

Columns reordering is enabled by default in the grid - you can control this using CanUserReorderColumns property. You can check this demo for more info about how to accomplish rows reorder.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Thor Elmer
Top achievements
Rank 1
answered on 08 Jun 2010, 04:36 PM
Hi

I have the same functionality demand as Dhileep.
Now, column reordering was no big deal as you have mentioned.
After that i followed the demo on how to implement the RadDragAndDropManager to reorder rows.

The problem now is that I can reorder rows, but the same functionality seems to kick into effect when I try to reorder my columns which lead to failure.

Is it possible to use standard columnreordering and the RadDragAndDropManager side by side or do i now have to implement a similar RadDragAndDropManager functionality in order to reorder my columns?

I'm not really shure wich part of my code i should post since i don't really know what i'm doing wrong, but  i am using silverlight controls version Q1 2010.
0
Vlad
Telerik team
answered on 09 Jun 2010, 06:44 AM
Hi,

Here is an example how to fix this:

private void OnOrderDragInfo(object sender, DragDropEventArgs e)
{
    if (e.Options.Source is GridViewHeaderCell)
    {
        return;
    }
    ...
}
 
private void OnOrderDragQuery(object sender, DragDropQueryEventArgs e)
{
    if (e.Options.Source is GridViewHeaderCell)
    {
        return;
    }
    ...
}
 
private void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
    if (e.Options.Source is GridViewHeaderCell)
    {
        return;
    }
    ...
}
 
private void OnGridViewDropInfo(object sender, DragDropEventArgs e)
{
    if (e.Options.Source is GridViewHeaderCell)
    {
        return;
    }
    ...
}
private void OnDropQuery(object sender, DragDropQueryEventArgs e)
{
    if (e.Options.Source is GridViewHeaderCell)
    {
        return;
    }
    ...
}



Sincerely yours,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Thor Elmer
Top achievements
Rank 1
answered on 09 Jun 2010, 09:09 AM
Nice!
Thanks for the easy solution! :)
Tags
GridView
Asked by
Dhileep Kumar Sampath
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Thor Elmer
Top achievements
Rank 1
Share this question
or