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

Help with drag/drop type functionallity

8 Answers 150 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Gabriela
Top achievements
Rank 1
Gabriela asked on 07 Apr 2011, 10:58 PM
Dear support community,

I am working with a form that will be used to schedule manufacturing orders.  Each column of the grid represents a piece of machinery (resource) and each cell in a column represents a placeholder for a work order (activity).

I have my grid working in such that it create the columns and populates the cells in each column with the activities assigned from a back end system.

Now I would like to make it so the user can drag/drop a cell from one row to a higher or lower row in the same column or to an entirely different cell in a different column.

I cannot figure out a way to allow a cell to be drag/dropped like with some of the other controls such as the Scheduler control (which I have tried but it does not seem suited to my application).

So one option would be to know which cell the user has the mouse over when clicked and also which cell the user has the mouse over when the mouse button is released and then execute some code afterwards to either automatically adjust the grid cell contents or in some cases prompt the user for what they wish to do.

Any help is greatly appreciated.

Best Regards,
Bill Mitchell

8 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 08 Apr 2011, 09:25 AM
Hello Bill,

Whilst you can certainly perform drag and drop functionality with the RadGridView, the scenario that you have described sounds like it is much better suited to using RadScheduler which allows for grouping of resources and so on. Have you looked into using this instead?

regards,
Richard
0
Svett
Telerik team
answered on 12 Apr 2011, 03:40 PM
Hi Gabriela Torres,

I enclosed a sample project that demonstrates how you can accomplish the required drag and drop functionality by using RadDragDropService and custom BaseGridBehavior class.

Kind regards,
Svett
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
Gabriela
Top achievements
Rank 1
answered on 12 Apr 2011, 06:59 PM
Dear Svett,

Thank you for taking the time to create a project to demonstrate the drag/drop functionallity of the RadGridView control.

Would it be possible for you to reattach the example having saved it in Visual Studio 2008 (or 2005 if 2008 is not available).  I am guessing you saved the previous example in VS2010 because my 2008 version will not open the project saying it was created with a newer version of Visual Studio.  Best Regards
0
Svett
Telerik team
answered on 15 Apr 2011, 09:34 AM
Hi Gabriela Torres, please find the same project converted for Visual Studio 2008. If you have any further questions or you need assistance, do not hesitate to contact us.

Greetings,
Svett
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
David
Top achievements
Rank 1
answered on 11 Aug 2011, 04:17 PM
Delete this post please. I should have dug a little bit more before I asked for help.
0
Gabriela
Top achievements
Rank 1
answered on 11 Aug 2011, 04:32 PM
David,

If you are in a hurry to get this accomplished, I suggest using Telerik's online C#/VB converter found at http://converter.telerik.com/

I also needed in VB and it worked well for me.  Best Regard.
0
Gabriela
Top achievements
Rank 1
answered on 11 Aug 2011, 04:36 PM
Here is a code snippet of what I used -

...initialization...

RadGridView1.GridBehavior =

New RadGridViewDragDropCells.CustomGridBehavior()

 

 

Dim dragDropService As RadDragDropService = Me.RadGridView1.GridViewElement.GetService(Of RadDragDropService)()

 

 

AddHandler dragDropService.PreviewDragOver, AddressOf dragDropService_PreviewDragOver

 

 

AddHandler dragDropService.PreviewDragDrop, AddressOf dragDropService_PreviewDragDrop

 


...and later in the program...

Private

 

Sub dragDropService_PreviewDragOver(ByVal sender As Object, ByVal e As RadDragOverEventArgs)

 

.....


Private

 

Sub dragDropService_PreviewDragDrop(ByVal sender As Object, ByVal e As RadDropEventArgs)
....

 

0
David
Top achievements
Rank 1
answered on 11 Aug 2011, 04:39 PM
Thanks Gabriela.
 
I read your reply after I edited my post. I am unfamiliar with .Net generics but it appears the concepts are similiar to C++ templates (used to swear by the STL so looks like it was mearly a case if mistaken syntax that was holding me up). A quick look in MSDN and it all started to come together.
I will certainly look at the tool you point out. It could come in handy. My dilema points out the only drawback I can think of. I had used templates, I don't know generics though I know I should and I want to but where is the time? I now have a situation where I am forced to research and hence learn and it is always a good day when I can learn something new!
Tags
GridView
Asked by
Gabriela
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Svett
Telerik team
Gabriela
Top achievements
Rank 1
David
Top achievements
Rank 1
Share this question
or