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

RadGrid drag & drop with Detail table

3 Answers 245 Views
Grid
This is a migrated thread and some comments may be shown as answers.
christina noel
Top achievements
Rank 1
christina noel asked on 02 Feb 2011, 11:50 PM
I'm using a RadGrid with drag & drop (using the DragDropColumn) to move the items of a detail table around (even between items on the master table). My problem is that when the row is accidentally dragged into the expand/collapse column of the master table, the eventArgs in OnRowDrop (server-side) don't tell me where it was dropped.

e.DestDataItem is null
e.HtmlElement is an empty string
e.DestinationTableView is the master table (not null, but not informative unless something else gets set there).

What I want is to be able to figure out which detail table row I'm next to. Failing that, I'd at least like to be able to tell which master table row I'm beneath so that I can add the item to the top of that detail table.

I'd appreciate any assistance in figuring this out.

--Christina Noel

3 Answers, 1 is accepted

Sort by
0
Accepted
Veli
Telerik team
answered on 08 Feb 2011, 09:36 AM
Hi christina,

If you drop over the expand/collapse column cell that is inside the nested view item in which the detail table is rendered, you would not get a destination data item on the server side RowDrop event:

RadGrid drag-drop over non-data item

This is because the GridNestedViewItem instance that holds your detail table is not a GridDataItem. Dropping over it does not give you a destination data item. You need to drop over a data item either from the master or the detail table to have RadGrid report the destination data item:

RadGrid drag-drop over a data item

If you want to prevent a postback on dropping over anything that is not a data item in RadGrid, you can use the client-side RadGrid OnRowDropping event:

<telerik:RadGrid>
    <ClientSettings AllowRowsDragDrop="true">
        <Selecting AllowRowSelect="true" />
        <ClientEvents OnRowDropping="gridRowDropping" />
    </ClientSettings>
</telerik:RadGrid>

function gridRowDropping(sender, args)
{
    if (!args.get_targetGridDataItem())
    {
        args.set_cancel(true);
    }
}


Veli
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Abhi
Top achievements
Rank 1
answered on 15 Jan 2013, 12:11 PM
Hello telerik,

thanks for explaining this,

i am also facing some problem
see my scenario of grid is like

contact 1
               -address 1
              - address 2
               -address 3
contact 2
              -address 1
              -address 2

here contact 1 and contact 2  are grid table view

i can drop the address row into the same contact
but the problem is when i drag to contact 1 in contact 2 it give me error
actually i done want to move contact
is there any property which can help me to stop moving contact
0
Maria Ilieva
Telerik team
answered on 18 Jan 2013, 10:27 AM
Hello Abhi,

Could you please share the exact error you received when trying to drag and drop between different detail tables and also what your RadGrid markup is as well as the related code behind? Thus we will be able to further research on the issue and provide a proper solution.

All the best,
Maria Ilieva
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
christina noel
Top achievements
Rank 1
Answers by
Veli
Telerik team
Abhi
Top achievements
Rank 1
Maria Ilieva
Telerik team
Share this question
or