I'm currently working on a application that uses the WebDataTree to display groups as nodes that have child nodes. My goal is to be able to move the parent nodes from one tree to another and vice versa. I'm running into an issue where after a node is moved around several times the node basically goes blank. Essentially I am moving one DataTreeNode object from one tree to another then back again. I have attached screen shots to show what is happening.
Before:
After:
I am not exactly sure what is causing the node to render empty. I am moving the nodes on the server side and am using full post backs.
Here's a code snippet:
Add:
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click ' Make sure we have a valid WG selected If wdtAllWg.SelectedNodes.Count > 0 Then ' Get selected nodes to add For Each wgNode As DataTreeNode In wdtAllWg.SelectedNodes ' Reset node and add to trees With wgNode .Selected = False .Expanded = False End With wdtEmpWg.Nodes.Add(wgNode) wdtCopyEmpWG.Nodes.Add(wgNode) ' Remove the node from the Dept WG's tree wdtAllWg.Nodes.Remove(wgNode) Next End If End Sub
Remove:
Protected Sub btnRemove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRemove.Click ' Make sure we have nodes selected to remove If wdtEmpWg.SelectedNodes.Count > 0 Then For Each wgNode As DataTreeNode In wdtEmpWg.SelectedNodes ' Collapse the node and remove it from emp WG trees With wgNode .Selected = False .Expanded = False End With ' Add WG back to the Dept WG tree wdtAllWg.Nodes.Add(wgNode) ' Remove the WG from the emp WG trees wdtEmpWg.Nodes.Remove(wgNode) wdtCopyEmpWG.Nodes.Remove(wgNode) Next End If End Sub I'm wondering is something is getting thrown off when moving the DataTreeNode from one tree to another. I am at a loss right now though.
Protected Sub btnRemove_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRemove.Click ' Make sure we have nodes selected to remove If wdtEmpWg.SelectedNodes.Count > 0 Then For Each wgNode As DataTreeNode In wdtEmpWg.SelectedNodes ' Collapse the node and remove it from emp WG trees With wgNode .Selected = False .Expanded = False End With ' Add WG back to the Dept WG tree wdtAllWg.Nodes.Add(wgNode) ' Remove the WG from the emp WG trees wdtEmpWg.Nodes.Remove(wgNode) wdtCopyEmpWG.Nodes.Remove(wgNode) Next End If End Sub
I'm wondering is something is getting thrown off when moving the DataTreeNode from one tree to another. I am at a loss right now though.
Hello Randy,
I created a support ticket on your behalf and linked it to the development issue in order to be notified when the service release with the fix is launched.
Regards,
Lyuba
Developer Support Engineer
Infragistics
www.infragistics.com/support
I was able to workaround the empty node issue using the WebDataTree CSOM. Now I am running into an intermittent issue with a server side error. I am assuming the error below is occurring when the WebDataTree control posts the client side event log to the server:
Insertion index was out of range. Must be non-negative and less than or equal to size.
StackTrace:
[ArgumentOutOfRangeException: Insertion index was out of range. Must be non-negative and less than or equal to size. Parameter name: index] System.Collections.ArrayList.Insert(Int32 index, Object value) +7535119 Infragistics.Web.UI.Framework.ObjectCollection.InternalInsert(Int32 index, ICollectionObject collectionObject) +257 Infragistics.Web.UI.NavigationControls.DataTreeNodeCollection.Insert(Int32 index, DataTreeNode item) +39 Infragistics.Web.UI.Framework.CommandExecuter.AddItemByAddress(DataTreeNode node, String address) +237 Infragistics.Web.UI.Framework.CommandExecuter.Execute(Dictionary`2 items) +248 Infragistics.Web.UI.Framework.DataTreeBot.LoadClientCollections(Object[] data) +1138 Infragistics.Web.UI.Framework.RunBot.LoadClientData() +85 Infragistics.Web.UI.Framework.RunBot.HandleLoadPostData(String postDataKey, NameValueCollection postCollection) +41 Infragistics.Web.UI.Framework.DataTreeBot.HandleLoadPostData(String postDataKey, NameValueCollection postCollection) +80 Infragistics.Web.UI.Framework.Data.HierarchicalDataBoundControlMain.LoadPostData(String postDataKey, NameValueCollection postCollection) +51 System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) +693 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1743
I notice that it mainly occurs when a node is moved between the trees multiple times before a postback. Also, I am not using the drag and drop framework. Nodes are being moved using buttons and the CSOM.
I submitted a ticket with developer support. Thanks for your help.
Lubomir Toshev said:You have drag drop turned off, but you use the new client side API for add/remove of nodes, right?
Yes, that's correct.
Hi,
It is better to contact developer support and post them the sample with which you experience this issue.
You have drag drop turned off, but you use the new client side API for add/remove of nodes, right?
Thanks,
Lubomir