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.
8 Answers, 1 is accepted
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?
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,
the Telerik team
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
the Telerik team
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...
Sub dragDropService_PreviewDragOver(ByVal sender As Object, ByVal e As RadDragOverEventArgs)
Sub dragDropService_PreviewDragDrop(ByVal sender As Object, ByVal e As RadDropEventArgs)
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!