I am population a WebDataTree using WebDataTree.Nodes.AddRange(). I build up my own List<DataTreeNode> dynamically.
This works correctly and I see all my nodes and child nodes however, on postback, all of the child nodes disappear, leaving me only with the top level nodes. There is no code running on PostBack. The population only happens when not a postback.
Am I doing something incorrectly here?
Hi,
Could you post the actual code you are using to add the nodes and children? It'll be easier for us to help that way.
regards,
David Young
private void PopulateTree() {
// Get the data List<CompanyEntity> companyList = this.BuildCompanyList(); List<CustomerEntity> customerList = this.BuildCustomerList();
List<DataTreeNode> nodeList = new List<DataTreeNode>(); foreach (CompanyEntity company in companyList) {
// Build the company node DataTreeNode companyNode = new DataTreeNode(); nodeList.Add(companyNode);
companyNode.Key = company.CompanyId.ToString(); companyNode.Value = company.CompanyId.ToString(); companyNode.Text = company.Description;
// Build the customer node list List<CustomerEntity> companyCustomerList = customerList.FindAll( delegate(CustomerEntity p) { return p.CompanyId == company.CompanyId; } );
companyCustomerList.Sort( delegate(CustomerEntity p1, CustomerEntity p2) { return p1.Name.CompareTo(p2.Name); } );
List<DataTreeNode> customerCollection = new List<DataTreeNode>(); foreach (CustomerEntity customer in companyCustomerList) {
DataTreeNode customerNode = new DataTreeNode(); customerNode.Key = customer.CustomerId.ToString(); customerNode.Value = customer.CustomerId.ToString(); customerNode.Text = customer.Name; customerCollection.Add(customerNode);
}
companyNode.Nodes.AddRange(customerCollection.ToArray());
// Display the data this.WebDataTree1.Nodes.AddRange(nodeList.ToArray());
Looking at your code, your problem seems very similar to this forum post.
http://forums.infragistics.com/forums/t/29187.aspx
This issue has been logged internally here and is being investigated. If you would like to contact dev support, the bug number is 19864.
In the meantime, you could try the work around mentioned in the other post. Simply try adding the nodes to the data tree before adding children. That seems to work ok.
That work around works, but it's a great shame the method we posted above doesn't work.