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

Telerik RadGrid Hierarchical - Drag Drop Row only in Detail Table

7 Answers 253 Views
Grid
This is a migrated thread and some comments may be shown as answers.
George
Top achievements
Rank 1
George asked on 23 Dec 2010, 11:46 AM
Hi,

I want to add the following functionality in a RadGrid but I don't know if it can work. I have a hierarchical Grid with the following structure:

MasterTable
    Item1
           DetailTable1
    Item2
          DetailTable2
    Item3

I want to add Drag and drop row functionality only in the Detail Tables rows. I mean, reordering only rows of each Detail Table. Can I achieve this? I saw some examples only for master table. If yes can you provide me with a link example please.

Thanks
George

7 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Dec 2010, 12:35 PM
Hello George,

You can achieve the desired scenario by setting the Name property for the Master and Detail table. On OnRowDragStarted client event check for the Name property and cancel accordingly. Similarly on OnRowDropped client event check for the name of targetItemTableView and cancel accordingly.

ASPX:
<ClientSettings AllowRowsDragDrop="true">
    <Selecting EnableDragToSelectRows="true" AllowRowSelect="true" />
    <ClientEvents OnRowDragStarted="OnRowDragStarted" OnRowDropped="OnRowDropped" />
</ClientSettings>

C#:
<script type="text/javascript">
    function OnRowDragStarted(sender, args) {
        if (args.get_tableView().get_name() == "Master") {
            args.set_cancel(true);
        }
    }
    function OnRowDropped(sender, args) {
        if (args._targetItemTableView.get_name() == "Master") {
            args.set_cancel(true);
        }
    }
</script>

Thanks,
Princy.
0
George
Top achievements
Rank 1
answered on 27 Dec 2010, 09:01 AM
Thanks for your reply, your solution solved my problem. Now I want to implement the code for reordering the data when a row is moved.Can anybody provide me with a useful link or I have to customize the following link code? ' http://demos.telerik.com/aspnet-ajax/grid/examples/programming/draganddrop/defaultvb.aspx '

Thanks
0
Iana Tsolova
Telerik team
answered on 29 Dec 2010, 05:04 PM
Hi George,

Indeed, you can use the mentioned demo as a sample. There you can see how the rows reordering for the items in the first grid is implemented.

All the best,
Iana
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
Nathan
Top achievements
Rank 1
answered on 03 Jan 2011, 03:22 PM
Hello,

I have three option button and when I click on option1 button I am populating an grid with detail table. For the other two option buttons I dont want to see the Heirarchical + symbole. How do I do this. (simply I want to hide the Heirarchical '+' for some situation)

0
Princy
Top achievements
Rank 2
answered on 04 Jan 2011, 06:03 AM
Hello Nathan,

You can  try any of following approaches to hide the Expand/Collapse column.

1: Add the following CSS in your page.
CSS:
<style type="text/css">
        .rgExpandCol
        {
            display:none !important;
        }
 </style>

2: Try the following code in PreRender event.
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
    {
        RadGrid1.MasterTableView.ExpandCollapseColumn.Display = false;
    }

Thanks,
Princy.
0
Nathan
Top achievements
Rank 1
answered on 04 Jan 2011, 02:36 PM
Thx much Princy.
0
Jatin
Top achievements
Rank 1
answered on 06 Jan 2016, 03:24 PM

Is there any working demo for this, I also need to implement the same functionality but the selection is not working in Child Grid.
I have tried various links for 
http://www.telerik.com/forums/drag-and-drop-in-hierarchy-grid

http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/declarative-relations/defaultcs.aspx

Individually these are working fine but when implementing the Drag-drop on Child Grid I am out of luck.

 Thanks in Advance.

Tags
Grid
Asked by
George
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
George
Top achievements
Rank 1
Iana Tsolova
Telerik team
Nathan
Top achievements
Rank 1
Jatin
Top achievements
Rank 1
Share this question
or