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 Object, ByVal 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