DragStatus always DragImpossible on RadGridView Header Cell

5 posts, 1 answers
  1. Dave Baumann
    Dave Baumann avatar
    2 posts
    Member since:
    May 2004

    Posted 09 Feb 2012 Link to this post

    After updating the Telerik RadControls for Silverlight to version 2011.3.1116.1040 we have found a problem with using the RadDragAndDropManager with the RadGridView. We have a scenario where we drag and drop items between two RadGridViews.  We are no longer able to drop items onto the Header Row of the RadGridView. The e.Options.Status in the OnDropInfo handler always returns DragStatus.DropImpossible. It looks like the source RadGridView is the only element firing the Drop Event and the target RadGridView is not firing the drop event at all.

    This worked prior to updating the controls to the version noted above.

    In our target OnDropQuery and OnDropInfo hanlders we added to following lines of code to allow the user to drop an item onto the header row of the RadGridView. It is now never being called.

        if (target is Telerik.Windows.Controls.GridView.GridViewHeaderCell)
                    gridview = ((GridViewHeaderCell)target).ParentRow.GridViewDataControl as RadGridView;

    The challenge is that when we have an empty RadGridView, we have no target to drop to.
  2. Answer
    Nick avatar
    593 posts

    Posted 10 Feb 2012 Link to this post

    Hello Dave,

    How exactly have you realized the DragAndDrop scenario? Mind that the Header Row cells handle the drag and drop events, so you will have to add the handlers with handledEventsToo set to true.

    this.GridView.AddHandler(RadDragAndDropManager.DragQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDragQuery), true);
                this.GridView.AddHandler(RadDragAndDropManager.DragInfoEvent, new EventHandler<DragDropEventArgs>(OnDragInfo), true);
                this.GridView.AddHandler(RadDragAndDropManager.DropQueryEvent, new EventHandler<DragDropQueryEventArgs>(OnDropQuery), true);
                this.GridView.AddHandler(RadDragAndDropManager.DropInfoEvent, new EventHandler<DragDropEventArgs>(OnDropInfo), true);

    I am attaching a small project demonstrating how you can achieve the desired functionality.

    Hope this helps!

    All the best,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. Dave Baumann
    Dave Baumann avatar
    2 posts
    Member since:
    May 2004

    Posted 10 Feb 2012 Link to this post

    Thanks for the reply Nik.

    Unfortunately my target RadGridViews are contained in a ListBox. On the left hand side I have a RadGridView of Unassigned work items, the Unassigned Queue. On the right-hand side I have a ListBox of Queues for users. The DataTemplate for those Queues is a RadGridView. Because the target RadGridViews are contained in a DataTemplate I cannot reference those RadGridViews by name in the code behind.

    Here is how I am registering the DropHandlers at the page level in the code behind.

         RadDragAndDropManager.AddDragQueryHandler(this, OnDragQuery);
                RadDragAndDropManager.AddDragInfoHandler(this, OnDragInfo);
                RadDragAndDropManager.AddDropQueryHandler(this, OnDropQuery);
                RadDragAndDropManager.AddDropInfoHandler(this, OnDropInfo);

    The code that checks the GridViewHeaderRow in the original post works with the .dlls you reference in your project.

    However, I changed the event bindings wiring them up to the standalone GridView and also to the parent ListBox containing the DataTemplate GridViews as in your example and the event handlers now work again as expected.


  4. Brandon
    Brandon avatar
    10 posts
    Member since:
    May 2012

    Posted 23 May 2012 Link to this post

    I am trying to implement something similar.  I have child grids that I want to drop on as well - and the header cells (of the parent and child grids) always have DragStatus.DropImpossible - even after I set all of the AllowDrop properties on the header cells and header row to true.  Any ideas?

  5. Sravanthi
    Sravanthi avatar
    6 posts
    Member since:
    May 2013

    Posted 20 Nov 2013 Link to this post

    Hello Dave,

    I have two Telerik RadGridViews. When the first RadGridView is empty I am unable to drag Items from second Grid.

Back to Top