Help with drag/drop type functionallity

9 posts, 0 answers
  1. Gabriela
    Gabriela avatar
    9 posts
    Member since:
    Sep 2008

    Posted 07 Apr 2011 Link to this post

    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
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 08 Apr 2011 Link to this post

    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
  3. Svett
    Admin
    Svett avatar
    728 posts

    Posted 12 Apr 2011 Link to this post

    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
  4. Gabriela
    Gabriela avatar
    9 posts
    Member since:
    Sep 2008

    Posted 12 Apr 2011 Link to this post

    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
  5. Svett
    Admin
    Svett avatar
    728 posts

    Posted 15 Apr 2011 Link to this post

    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
  6. David
    David avatar
    3 posts
    Member since:
    Sep 2012

    Posted 11 Aug 2011 Link to this post

    Delete this post please. I should have dug a little bit more before I asked for help.
  7. Gabriela
    Gabriela avatar
    9 posts
    Member since:
    Sep 2008

    Posted 11 Aug 2011 Link to this post

    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.
  8. Gabriela
    Gabriela avatar
    9 posts
    Member since:
    Sep 2008

    Posted 11 Aug 2011 Link to this post

    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)
    ....

     

  9. David
    David avatar
    3 posts
    Member since:
    Sep 2012

    Posted 11 Aug 2011 Link to this post

    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!
Back to Top