Telerik RadGrid Hierarchical - Drag Drop Row only in Detail Table

8 posts, 0 answers
  1. George
    George avatar
    12 posts
    Member since:
    Nov 2010

    Posted 23 Dec 2010 Link to this post

    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
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 23 Dec 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. George
    George avatar
    12 posts
    Member since:
    Nov 2010

    Posted 27 Dec 2010 Link to this post

    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
  5. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 29 Dec 2010 Link to this post

    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.
  6. Nathan
    Nathan avatar
    13 posts
    Member since:
    Aug 2010

    Posted 03 Jan 2011 Link to this post

    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)

  7. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 04 Jan 2011 Link to this post

    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.
  8. Nathan
    Nathan avatar
    13 posts
    Member since:
    Aug 2010

    Posted 04 Jan 2011 Link to this post

    Thx much Princy.
  9. Jatin
    Jatin avatar
    2 posts
    Member since:
    Oct 2007

    Posted 06 Jan Link to this post

    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.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017