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

[Solved] Move Row within RadGridView

24 Answers 661 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manas
Top achievements
Rank 1
Manas asked on 22 May 2009, 08:15 AM
Hi,

I want to Move Row (UP and Down) within RadGridView like Column, as effect some Id type column data should be rearrange within RadGridView.

I am Finding it soon.

Thanks

24 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 22 May 2009, 09:17 AM
Hello Manas,

Please check the attached project for more info.

Kind regards,
Vlad
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Manas
Top achievements
Rank 1
answered on 22 May 2009, 10:34 AM
Thanks man for your quick response, but here situation is some diffrent, on a same user control I have Radtreeview and RadGridView and currently drag and drop is working from tree to grid. Radgridview is Hierarchy level and one column is Control Template of ListBox, where I am doing drop (add ListItem). Now i will try to accumulate your running code into my project.

Let you know, what is happing........
Thanks you very much...


Thanks,
Manas
0
Manas
Top achievements
Rank 1
answered on 25 May 2009, 07:39 AM

Now it is working fine with simple grid, but when I am trying to implement it on Hierarchy of grid then problem is there. For create hierarchy of grid I have used bellow direction.

 

Declare it on page Load

//For Hierarchy of grid

this.gridLesson.TableDefinition.PreviewDataRecordCreate += this.MasterTableDefinition_PreviewDataRowCreate;

 

Now Create “MasterTableDefinition_PreviewDataRowCreate” event.

 

//Hierarchy Grid Load

        private void MasterTableDefinition_PreviewDataRowCreate(object sender, DataRecordCreateEventArgs e)

        {

            e.IsExpandableRecord = true;

            GridViewTableDefinition detailDefinition = new GridViewTableDefinition();

            detailDefinition.Relation = new PropertyRelation("Files");

            e.ChildTableDefinitions.Add(detailDefinition);

 

        }

 

Can you help me for Grid Row Drag and Drop on that sitution.

 

Thanks,

Manas

0
Milan
Telerik team
answered on 28 May 2009, 04:20 PM
Hi Manas,

It is actually quite difficult to figure out what has gone wrong without more information. Nevertheless, I am sending you an updated version of the original files in rowdragdrop.zip. GridViewRowDragDropManager now works better with hiearachy and also the ReorderRequestedEventArgs provides more information that can be useful in hierarchy scenerios.

Could you try to inforporate the updated files in your solution and see if the problems that you have reported are fixed. If not, may I ask oyu to send us your application so that we can take a closer look at the problem? You can send us files by opening a support ticket.

Hope this helps.

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Manas
Top achievements
Rank 1
answered on 29 May 2009, 10:12 AM
Hi Milan,
I am not getting any link for updated version of the original files in rowdragdrop.zip. I hope, that would be very helpful for me.
kindly send me  updated version of the original files in rowdragdrop.zip link.


Thanks,
Manas
0
Milan
Telerik team
answered on 29 May 2009, 10:37 AM
Hello Manas,

Here is the updated project that I have promised. Only two files are changed (GridViewRowDragDropManager.cs and ReorderRequestedEventArgs.cs) and one new file is added (GridViewRowExtensions.cs).
Sorry for the inconvenience.

Greetings,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Manas
Top achievements
Rank 1
answered on 10 Jun 2009, 08:16 AM
May you give me details about support ticket, so I can upload my project to close look. There are still issue to configure your Grid Row drag and Drop Code into my hierarcy Grid.

Thanks for your excellent support.


Regards,
Manas
0
Manas
Top achievements
Rank 1
answered on 14 Jun 2009, 08:17 AM

Thanks Milan,

 

Now Grid row drag and drop is working fine with hierarchy grid. But I am facing another problem, that is we have applied custom row style link  RowStyle="{StaticResource CustomRowStyle}" on Grid then I cannot select any row to copy paste from Excel, which one was working previously.

 

May you help regarding that quickly?

 

Regards,

Manas

0
Milan
Telerik team
answered on 15 Jun 2009, 11:25 AM
Hello Manas,

Unfortunately the copy to clipboard functionality only works for the WPF version of RadGridView due to limitations of the Silverlight plugin.
Sorry for this inconvenience.

Best wishes,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Manas
Top achievements
Rank 1
answered on 15 Jun 2009, 05:21 PM

Sorry for little misunderstanding here, already I have developed Copy to Clipart from RadGridView in Silver light and paste also, now problem is when I have applied Row Style (RowStyle="{StaticResource CustomRowStyle}") on Hierarchical RadGridView for Drag and Drop Row within Grid then I can’t select a full row.

 

So, right now I can’t select full row to copy paste. I hope, now you can understand, what my goal is.

 

Regards,

Manas

0
Milan
Telerik team
answered on 16 Jun 2009, 08:05 AM
Hello Manas,

The selection mechanism should be working. If you take a look at the SelectedItems collection you will see that items are indeed selected. The actual problem is that the custom style does not include visual styles that respond to the different row states. I am sending you the style and template of GridViewRow as a reference.

Just a quick reminder - whenever you select an item in a child grid this selection will not be reflected in the SelectedItems of the parent grid but only in the SelectedItems of the child grid itself. 

Sincerely yours,
Milan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Patrick Holloway
Top achievements
Rank 1
answered on 16 Oct 2009, 02:18 PM
These drag-drop solutions are helpful, thanks! However, they all rely on casting the GridViewRow to a DataRecord, which is now deprecated (and missing from 2009 Q3), to get the row index within the grid.

Since DataRecord is going away, what's the best way to get the row index?
0
Vlad
Telerik team
answered on 16 Oct 2009, 02:22 PM
Hi Patrick,

You can use Items property to get desired data item index.

All the best,
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
Patrick Holloway
Top achievements
Rank 1
answered on 16 Oct 2009, 02:38 PM
So, something like

idx = gridView.Items.IndexOf(aRow);

Not working for me either, I'm afraid.

0
Vlad
Telerik team
answered on 16 Oct 2009, 02:47 PM
Hi Patrick,

if aRow is some of your business objects there should be no problems.

Sincerely yours,
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
Patrick Holloway
Top achievements
Rank 1
answered on 16 Oct 2009, 02:58 PM
Thanks Vlad, that makes sense. This is in the context of GridViewRowDragDropManager.ParentControl_MouseUp() as posted by Milan in the rowdragdrop2.zip project on May 29, that is what I'm working with. So to get the dragged row's index, I can do

 

 

oldIndex = gridView.Items.IndexOf(originalRow.DataItem);

which works nicely. Thanks!

-p

 

0
James
Top achievements
Rank 1
answered on 29 Oct 2009, 09:13 PM

Hi Vlad,

I have experimented with your example of moving rows within a GridView and it all works fantastically.

My question is, will this ever be provided OOB by the GridView in a future release?

There is a lot of boiler plate code involved in your example that ideally should be abstracted outside of my application (like how DragDrop works).

Kind regards,
James.

0
Vlad
Telerik team
answered on 30 Oct 2009, 07:55 AM
Hello James,

Since now our Drag & Drop framework is available for both Silverlight and WPF this is preferred way. Please check this demo for more info:
http://demos.telerik.com/silverlight/beta/#DragAndDrop/TreeToGrid

Best wishes,
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
Tejas Joshi
Top achievements
Rank 1
answered on 18 Nov 2009, 06:24 AM
Hi,
    I have a particular requirement wherein I have a Radgridview which is populated with some data and each row has a button. Now on click of this button I want to select the corresponding row of the RadGridView and iterate through each cell.

Thanks,
Tejas
0
Vlad
Telerik team
answered on 18 Nov 2009, 07:24 AM
Hello,

You can get the row from the button click event handler using our powerful extension methods:

var row = ((Button)sender).ParentOfType<GridViewRow>();

Kind regards,
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
Scott Christian
Top achievements
Rank 1
answered on 05 Jan 2010, 11:47 PM
Could I get the example of changing order of rows by dragging, if implementation is different, of the functionality posted May 22, 2009. In WPF and with the Q3 SP1 Controls.

Scott
0
Tsvyatko
Telerik team
answered on 07 Jan 2010, 08:32 AM
Hi Scott Christian,

Using Q3 SP1 allows you to achieve similar functionality using DragDrop manager. Attached you will find sample WPF application demonstrating row reorder using DragDrop Manager.

For more information about RadDragDrop Manager you can check your Examples and Documentation.

Hope this helps.

All the best,
Author Tsvyatko
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
Sir
Top achievements
Rank 1
answered on 30 Oct 2010, 12:46 AM
Hi,

Can I get this example but for Silverlight 4 / Telerik 2010.2.0714.1040?
The WPF example has SL unusable code
 
GridViewRow row = this.GetRowFromHitTest(this.RadGridViewe.Options.CurrentDragPoint);
HitTestResult result = VisualTreeHelper.HitTest(subTree, intesectionPoint);

Thanks,
Ray

0
Tsvyatko
Telerik team
answered on 01 Nov 2010, 04:50 PM
Hi Scott,

 I have modified the project to make it work in silverlight. Please have a look at the attachment and let me know if you need any further assistance.

Best wishes,
Tsvyatko
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
Tags
GridView
Asked by
Manas
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Manas
Top achievements
Rank 1
Milan
Telerik team
Patrick Holloway
Top achievements
Rank 1
James
Top achievements
Rank 1
Tejas Joshi
Top achievements
Rank 1
Scott Christian
Top achievements
Rank 1
Tsvyatko
Telerik team
Sir
Top achievements
Rank 1
Share this question
or