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

Node OnClientNodeDropping to Grid

1 Answer 67 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Jason
Top achievements
Rank 2
Jason asked on 05 Jun 2009, 12:56 PM

Hi,

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  
            ProjectApplicationsDataSource.Insert()  
            ProjectApplicationsGrid.Rebind()  
 
        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();  
            alert(dest);  
            if (dest==null) { args.set_cancel(false); return; } else { args.set_cancel(true); return; } ;  
 
        } 

Hope you can help.

Thanks
Jase

1 Answer, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 10 Jun 2009, 09:14 AM
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.
Tags
TreeView
Asked by
Jason
Top achievements
Rank 2
Answers by
Veselin Vasilev
Telerik team
Share this question
or