Node OnClientNodeDropping to Grid

2 posts, 0 answers
  1. Jason
    Jason avatar
    17 posts
    Member since:
    Mar 2009

    Posted 05 Jun 2009 Link to this post


    I am trying to integrate a treeview and grid by dragging nodes to the grid to create records.  I have code working where I can drag a treenode to a grid and fire the code behind to insert a new record etc...

        Protected Sub ApplicationsTreeView_OnNodeDrop(ByVal sender As ObjectByVal e As Telerik.Web.UI.RadTreeNodeDragDropEventArgs) Handles ApplicationsTreeView.NodeDrop  
            If e.HtmlElementID = (ProjectApplicationsGrid.ClientID & "_GridData"Then 
                Dim InsertRecordDataSource As SqlDataSource = ProjectApplicationsDataSource  
                Dim Project_ID As Integer = CInt(Request.QueryString("Project_ID"))  
                Dim Application_ID As Integer = CInt(e.SourceDragNode.Value)  
                InsertRecordDataSource.InsertParameters("Project_ID").DefaultValue = Project_ID  
                InsertRecordDataSource.InsertParameters("Application_ID").DefaultValue = Application_ID  
            End If 

    The following function cancels the nodedrop postback if the node is dropped onto a treeview node.  But the postback also doesn't fire if the node is dropped onto a highlighted grid row.  I.e.  The code behind is only fired if I drag the treeview node onto a part of the grid that doesn't contain any rows.

            function ApplicationsTreeView_ClientNodeDropping(sender, args) {  
                var dest = args.get_destNode();  
                if (dest==null) { args.set_cancel(false); return; } else { args.set_cancel(true); return; } ;  

    Hope you can help.

  2. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 10 Jun 2009 Link to this post

    Hello Jason,

    Can you reproduce the problem on our online demo? I can drag a node from the first treeview to the grid with no problem?

    Also, when you drag onto a highlighted row in the grid what is the value of the dest variable? Isn't it null?

    All the best,
    Veselin Vasilev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top